課程
/前端開發(fā)
/前端工具
/Vue+Webpack打造todo應用
這個問題沒搞明白?
2020-01-13
源自:Vue+Webpack打造todo應用 2-1
正在回答
webpack.config.js 最新版vue-loader的文件中的內容要調整,可以參考如下配置
const?path?=?require('path')const?VueLoaderPlugin?=?require('vue-loader/lib/plugin')module.exports?=?{mode:'none',entry:?path.join(__dirname,?'src/index.js'),output:?{filename:?'bundle.js',path:?path.join(__dirname,?'dist')},module:?{rules:[{test:/.vue$/,loader:?'vue-loader'},?????//?它會應用到普通的?`.js`?文件?????//?以及?`.vue`?文件中的?`<script>`?塊{test:?/\.js$/,loader:?'babel-loader'},?????//?它會應用到普通的?`.css`?文件?????//?以及?`.vue`?文件中的?`<style>`?塊{test:?/\.css$/,use:?['vue-style-loader','css-loader']}]},plugins:?[???//?請確保引入這個插件!new?VueLoaderPlugin()]}
慕粉1505578130 提問者
1、安裝幾個工具。在控制臺,分別輸入:
npm install @babel/core
npm install bable-loader
npm install? vue-style-loader
npm install vue-template-compiler
2、然后在檢查webpack.config.js的位置(與src文件夾同級)
3、然后修改webpack.config.js的內容為:
const?path=?require('path')
const?VueLoaderPlugin?=?require('vue-loader/lib/plugin.js')
module.exports?=?{
??entry:path.join(__dirname,'src/index.js'),
??output:{
????filename:'bundle.js',
????path:path.join(__dirname,'dist')
??},
??module:{
????rules:[
??????{
????????test:/.vue$/,
????????loader:?'vue-loader'
??????},{
????????test:?/\.js$/,
????????loader:?'babel-loader'
????????test:?/\.css$/,
????????use:['vue-style-loader','css-loader']
??????}
????]
??plugins:[new?VueLoaderPlugin()]
}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
慕村9208018
奔向一萬小時
weixin_慕九州2459105
慕蓋茨935531
海的飄逸 回復 慕蓋茨935531
還需要安裝 @babel/core? babel-loader? vue-style-loader? vue-template-compiler 這幾個工具
bonyun006
舉報
用前端最熱門框架Vue+最火打包工具Webpack打造todo應用
1 回答安裝完webpack-cli還是報錯
1 回答未安裝插件卻運行成功
1 回答項目完成后打包安裝extract-text-webpack-plugin插件為什么報錯
3 回答styl文件報錯、但已安裝依賴包
4 回答運行npm run build 報錯,已裝了webpack-cli
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2020-01-13
webpack.config.js 最新版vue-loader的文件中的內容要調整,可以參考如下配置
2020-01-16
1、安裝幾個工具。在控制臺,分別輸入:
npm install @babel/core
npm install bable-loader
npm install? vue-style-loader
npm install vue-template-compiler
2、然后在檢查webpack.config.js的位置(與src文件夾同級)
3、然后修改webpack.config.js的內容為:
const?path=?require('path')
const?VueLoaderPlugin?=?require('vue-loader/lib/plugin.js')
module.exports?=?{
??entry:path.join(__dirname,'src/index.js'),
??output:{
????filename:'bundle.js',
????path:path.join(__dirname,'dist')
??},
??module:{
????rules:[
??????{
????????test:/.vue$/,
????????loader:?'vue-loader'
??????},{
????????test:?/\.js$/,
????????loader:?'babel-loader'
??????},{
????????test:?/\.css$/,
????????use:['vue-style-loader','css-loader']
??????}
????]
??},
??plugins:[new?VueLoaderPlugin()]
}
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2020-01-13
還需要安裝 @babel/core? babel-loader? vue-style-loader? vue-template-compiler 這幾個工具