Vue.js component pre-loader for Webpack
In vue file, this loader create a new way to import your components.
// From this
...'path/to/your/component.vue'
// To this
'component-': () => import('path/to/your/component.vue')
- Install Packge via Github
npm install phamhongphuc/vue-import-loader
- Add
vue-import-loader
aftervue-loader
in webpack config
module.exports = {
// More config
module: {
rules: [
{
test: /\.vue$/,
use: [
{
loader: "vue-loader",
query: {
presets: ["es2015", "stage-2"]
}
},
{
loader: "vue-import-loader"
}
]
}
]
}
};
😎 Happy Coding 😎