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

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.

主站蜘蛛池模板: 钟山县| 称多县| 鄂温| 佛坪县| 灌南县| 大悟县| 自贡市| 灯塔市| 新野县| 静乐县| 崇信县| 云安县| 班戈县| 蒲江县| 喜德县| 治县。| 保定市| 额尔古纳市| 镇远县| 溆浦县| 博野县| 沂源县| 寿阳县| 宾阳县| 武乡县| 南部县| 洮南市| 忻州市| 舒兰市| 景泰县| 固原市| 剑川县| 屯门区| 宣恩县| 金华市| 若尔盖县| 雅江县| 米泉市| 颍上县| 林州市| 孟州市|