I have a Webpack project, and I want to use Vue in it. I'm importing Vue in my JavaScript file like this:
import "../../node_modules/vue/dist/vue.min.js";
I can see vue.min.js in my bundle, but when I try to instantiate Vue in my HTML file or JavaScript file like this:
var app = new Vue({
el: ‘#app’,
data: {
message: ‘Hello Vue!’
}
})
I get this error in the console:
Uncaught ReferenceError: Vue is not defined
at eval (ins.js?be14:2)
at Object../src/scripts/ins.js (app.js:485)
at __webpack_require__ (app.js:79)
at eval (index.js?48f5:1)
at Module../src/scripts/index.js (app.js:474)
at __webpack_require__ (app.js:79)
at Object.0 (app.js:530)
at __webpack_require__ (app.js:79)
at checkDeferredModules (app.js:46)
at app.js:152
I tried to add vue.min.js directly in my HTML via CDN, and everything works fine. Is there is some ordering problem on load? How do I solve this problem?