vue-multi-loader
Vue.js component loader for Webpack, using Webpack loaders for the parts.
It allows you to write your components in this format:
// app.vue{{msg}}
You can also mix preprocessor languages in the component file:
// app.vue
And you can import using the src
attribute (note that there's no need for a lang
attribute here, as Webpack will
be used to determine which loader applies):
Usage
Config Webpack:
// webpack.config.jsmoduleexports =entry: "./main.js"output:filename: "build.js"module:loaders:test: /\.vue$/ loader: "vue-multi-loader"
And this is all you need to do in your main entry file:
// main.jsvar Vue =var appOptions =var app = appOptions
Loader configuration
By default, vue-multi-loader
will try to use the loader with the same name as
the lang
attribute, but you can configure which loader should be used.
For example, to extract out the generated css into a separate file, use this configuration:
// webpack.config.jsvar ExtractTextPlugin = ;var vue = ;moduleexports =entry: "./main.js"output:filename: "build.js"module:loaders:test: /\.vue$/ loader: vueplugins:"[name].css"