I'm using laravel 5.3 and vuejs. I have defined a javascript class named 'Form' inside a js file named form.js and I want to create an object of this class in app.js file. I have added both js files in webpack and I have also required the 'form.js' file inside the app.js. But I get the following error :
Uncaught ReferenceError: Form is not defined ...
Here is my app.js code :
require('./bootstrap');
require('./form.js');
formElm = document.getElementById('form');
new Vue({
el: "#form",
data: {
form: new Form(formElm)
},
methods: {
....
}
});
And here is my form.js code :
class Form {
constructor(formElm) {
...
}
...
}
And this is how I've added the js files in gulpfile.js :
elixir(mix => {
mix.sass('app.scss')
.webpack(['app.js', 'form.js'], 'public/js/app.js');
});
Am I missing something ?