準備學習Web前端工程化的內容,做個記錄,以后需要的時候方便查找:
webpack只能打包處理.js相關的文件,其他資源可以使用插件的方式來曲線救國。
1 安裝vue組件的加載器,命令如下:
??? npm install vue-loader vue-template-compiler -D
2 配置規則:更改webpack.config.js的module中的rules數組
const VueLoaderPlugin = require("vue-loader/lib/plugin");
const vuePlugin = new VueLoaderPlugin();
module.exports = {
??????? plugins:[ htmlPlugin, vuePlugin? ],
??????? module : {
??????????? rules:[
????????????????????.......????????????????
????????????????????{?
??????????????????? ????test:/\.vue$/,
??????????????????????? loader:"vue-loader",
??????????????????? }
??????????? ]
??????? }
} ?