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

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.

主站蜘蛛池模板: 姜堰市| 梅河口市| 乌鲁木齐县| 澄江县| 贡山| 安塞县| 庆云县| 浦东新区| 晋江市| 常山县| 丰顺县| 宁南县| 乐平市| 西吉县| 嘉祥县| 宜春市| 宁海县| 镇坪县| 邯郸市| 乐业县| 固安县| 淮安市| 祥云县| 万荣县| 绥芬河市| 中西区| 涡阳县| 白银市| 通化市| 泰来县| 团风县| 南华县| 金塔县| 六盘水市| 德阳市| 钟山县| 乃东县| 乐清市| 黄骅市| 寿阳县| 永吉县|