官术网_书友最值得收藏!

Vue-loader

Inside of our ./webpack-config.js within the standard webpack-simple template, we have a module object that allows us to set up our loader; this tells Webpack that we'd like it to use .vue files inside of our project:

module: {
rules: [{
test: /\.vue$/,
loader: 'vue-loader',
options: {
loaders: {}
// other vue-loader options go here
}
}]

For this to work, Webpack runs a regular expression for anything that matches .vue and then passes this to our vue-loader to be transformed into a plain JavaScript module. In this simple example, we're loading files with a .vue extension, but vue-loader can be further customized and you may want to look into this further (https://goo.gl/4snNfD). We could certainly do this configuration ourselves, but hopefully, you can see the benefits of using the Vue CLI to generate our Webpack projects.

主站蜘蛛池模板: 南涧| 罗甸县| 长顺县| 西盟| 巴南区| 孟州市| 柳江县| 七台河市| 健康| 恩平市| 南陵县| 两当县| 图们市| 体育| 东兰县| 淳安县| 东方市| 和田县| 车致| 敦化市| 霍邱县| 顺平县| 广水市| 东兰县| 金阳县| 平南县| 宁陵县| 德安县| 东丰县| 新绛县| 抚远县| 句容市| 泗洪县| 宁夏| 景宁| 玛多县| 元氏县| 皋兰县| 崇义县| 离岛区| 义马市|