New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module build failed: TypeError: this._init is not a function #409
Comments
I had a similar situation - looks like webpack is using vue itself for loader instead of vue-loader in this case.
|
@delta77x Your answer saved my afternoon!! Thx!! :D |
I just had the same issue. changing to vue-loader in webpack config helped. |
@delta77x you saved my day ! thanks ! |
This was it - *-loader is no longer optional with webpack. Changing vue to vue-loader fixed this |
Close |
@rudidev08 any idea why it was ever optional anyway? |
I got this error in another way, so for anyone else who finds this and the above solution does not solve the error.... I got the error by accidentally importing vue twice which consequently instantiated vue twice. So in my main app I had import Vue from 'vue'
const app = new Vue({
// stuff ...
}) and then in another file that instantiated my router import VueRouter from 'vue' // <-- This was the typo. Should have been 'vue-router'
export default new VueRouter({
// stuff ...
}) |
For anyone coming here from Google, I was having the same issue when trying to inject dependencies into a Vue component, using the official webpack template for unit tests. I also solved it by changing this line: const injector = require('!!vue?inject!@/components/MyComponent') For the following: const injector = require('!!vue-loader?inject!@/components/MyComponent') The key is to replace |
@delta77x thanks!!! |
…yword Found answer at: vuejs/vue-loader#409 (comment) Thank you, @Protossoario, thank you, sir! :D
@delta77x thanks a lot,save my day!!! |
Hey, I have the same problem, but cannot find anything about loader: vue (or rule) in the webpack configs of laravel-mix. Please help |
I have already changed loader:'vue' to loader: 'vue-loader' in webpack.config,but this problem can not be solved |
For anyone having this error, looks like regenerating |
私はこのように記述することで回避しました
|
…yword Found answer at: vuejs/vue-loader#409 (comment) Thank you, @Protossoario, thank you, sir! :D
I'm trying to build an electron app that will be using vue.js as well as electron-builder for final distribution. The electron-builder docs suggest using a two-package.json setup where the devDependencies are in the main package.json, and the dependencies are in app/package.json.
However, when I try to incorporate vue.js into this app, I run into problems because of this two-package.json setup. I get the following output when trying to run webpack:
My index.js looks like this:
And the directory structure of the relevant files in my project looks like this:
Commenting out the
import MainScreen
line results in webpack running successfully.Another configuration where webpack works is if I move vue from a dependency in app/package.json to the main package.json, and also remove vue from the app/node_modules folder. This is not acceptable, though, because I need vue as a dependency in app/package.json in order to do make my app installers. If I have vue as a dependency in both package.json and app/package.json I still get the error above, even if I explicitly
import Vue from '../node_modules/vue'
in index.js. (IE, webpack seems to be using /app/node_modules/vue rather than /node_modules/vue)Am I missing something here? Could anyone help me configure this so I can use both vue.js with webpack, and electron-builder with its two-package.json setup?
This issue is related to #171 which was closed due to inactivity.
The text was updated successfully, but these errors were encountered: