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

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.

主站蜘蛛池模板: 武宣县| 台湾省| 潢川县| 普安县| 潼南县| 凭祥市| 锡林浩特市| 原阳县| 吕梁市| 聂拉木县| 济南市| 佳木斯市| 高台县| 茶陵县| 林西县| 彩票| 藁城市| 大足县| 康保县| 桓台县| 平远县| 女性| 和政县| 北川| 铁岭县| 环江| 柘城县| 黔西| 阿巴嘎旗| 长寿区| 枝江市| 泗水县| 浏阳市| 广宁县| 常宁市| 长垣县| 金溪县| 宁陵县| 姜堰市| 灵石县| 澎湖县|