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

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.

主站蜘蛛池模板: 余干县| 海安县| 密云县| 卢龙县| 镇安县| 耒阳市| 华阴市| 龙口市| 昌黎县| 赣州市| 信阳市| 仲巴县| 深州市| 塘沽区| 达拉特旗| 涡阳县| 同江市| 长海县| 合肥市| 常熟市| 旌德县| 宝应县| 开原市| 通化县| 吴堡县| 大埔县| 太保市| 镇巴县| 独山县| 道孚县| 湖州市| 凤城市| 色达县| 弋阳县| 隆子县| 枣阳市| 石景山区| 来安县| 泸西县| 东乡县| 玛曲县|