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

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.

主站蜘蛛池模板: 交城县| 平利县| 长子县| 赤壁市| 长治县| 周口市| 广平县| 成武县| 视频| 全椒县| 苍梧县| 白朗县| 精河县| 建始县| 西乌珠穆沁旗| 太康县| 凤庆县| 永城市| 蒙自县| 灵寿县| 三河市| 金昌市| 松桃| 大荔县| 高州市| 舞钢市| 托克托县| 鲁甸县| 十堰市| 辽中县| 甘谷县| 玉环县| 舞阳县| 东乡族自治县| 年辖:市辖区| 砚山县| 新沂市| 齐齐哈尔市| 乡城县| 洮南市| 平乡县|