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

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.

主站蜘蛛池模板: 鸡东县| 横山县| 云龙县| 泽库县| 阿坝县| 长葛市| 灵丘县| 新民市| 汕尾市| 石棉县| 太康县| 洱源县| 开江县| 凭祥市| 阳春市| 利川市| 黎川县| 龙州县| 五原县| 清河县| 中宁县| 崇州市| 东辽县| 柞水县| 濉溪县| 尖扎县| 漳平市| 彭山县| 广德县| 宝应县| 原阳县| 渭源县| 酉阳| 灵宝市| 淄博市| 溧水县| 大余县| 巴林右旗| 承德县| 加查县| 星子县|