December 2017
Beginner to intermediate
376 pages
7h 53m
English
Let's copy the mock data dependency into the project as well:
$ cp ../vuebnb-prototype/sample/data.js ./resources/assets/js/
Currently, this file declares a global variable sample that is then picked up in the entry file. Let's make this file a module by replacing the variable declaration with an ES2015 export default.
resources/assets/js/data.js:
export default { ... }
We can now import this module at the top of our entry file. Note that Webpack can guess the file extension in an import statement so you can omit the .js from data.js.
resources/assets/js/app.js:
import sample from './data'; var app = new Vue({ ... });
Read now
Unlock full access