課程
/前端開發(fā)
/前端工具
/Vue+Webpack打造todo應(yīng)用
錯誤不能找到package.json
2018-09-13
源自:Vue+Webpack打造todo應(yīng)用 2-1
正在回答
你index.js? 里? new Vue( {
})? vue 拼寫錯了
入門級就這么想讓我跑路?
stone310
我找到了答案,分享給大家。
只要修改webpack.config.js就可以打包了。
const path = require('path');? ?
const {VueLoaderPlugin}=require('vue-loader');??
????module.exports = {
????????entry: path.resolve(__dirname, "src/index.js"),? ?//webpack4官方絕對路徑
????devServer: {
????????contentBase: './dist'
????},
????output: {
????filename: 'bundle.js',
????????path: path.resolve(__dirname, 'dist')
????module: {
????rules: [
????????{
test: /\.vue$/,
use: [
'vue-loader'????????
]
},
{
test: /\.css$/,
'vue-style-loader',????????????????//可以不要
'style-loader',????????????????????????
'css-loader'
plugins:[
new VueLoaderPlugin()
};
寶慕林3083921 提問者
如果是webpack 4+ 要額外安裝CLI?
npm?install?--save-dev?webpack-cli
stone310 回復(fù) 寶慕林3083921 提問者
寶慕林3083921 提問者 回復(fù) stone310
舉報
用前端最熱門框架Vue+最火打包工具Webpack打造todo應(yīng)用
4 回答請問執(zhí)行 npm run build 時出現(xiàn)這個錯誤是怎么回事
1 回答npm run build 報這個錯誤是怎么回事?
3 回答npm run build時出現(xiàn)錯誤
5 回答npm run build報錯怎么回事
4 回答執(zhí)行npm run build報錯
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2018-11-07
你index.js? 里? new Vue( {
})? vue 拼寫錯了
2018-09-15
2018-09-14
我找到了答案,分享給大家。
只要修改webpack.config.js就可以打包了。
const path = require('path');? ?
const {VueLoaderPlugin}=require('vue-loader');??
????module.exports = {
????????entry: path.resolve(__dirname, "src/index.js"),? ?//webpack4官方絕對路徑
????devServer: {
????????contentBase: './dist'
????},
????output: {
????filename: 'bundle.js',
????????path: path.resolve(__dirname, 'dist')
????},
????module: {
????rules: [
????????{
test: /\.vue$/,
use: [
'vue-loader'????????
]
},
{
test: /\.css$/,
use: [
'vue-style-loader',????????????????//可以不要
'style-loader',????????????????????????
'css-loader'
]
},
]
},
plugins:[
new VueLoaderPlugin()
]
};
2018-09-14
如果是webpack 4+ 要額外安裝CLI?