在命令行執(zhí)行webpack使用的是全局安裝的webpack,會(huì)到npm的全局文件夾下去找webpack,如果沒(méi)全局安裝 -g(-global),就會(huì)報(bào)錯(cuò).
如果沒(méi)全局安裝,可以cd到項(xiàng)目目錄,命令行執(zhí)行node_module/.bin/webpack hello.js hello.bundle.js.
還有一種方法是配置npm的package.json文件,在script里面配置上script{start: webpack},然后在命令行執(zhí)行npm start(或npm run start),實(shí)際上會(huì)執(zhí)行webpack指令,npm會(huì)默認(rèn)加上node_module/.bin/,和上面一樣的效果
如果沒(méi)全局安裝,可以cd到項(xiàng)目目錄,命令行執(zhí)行node_module/.bin/webpack hello.js hello.bundle.js.
還有一種方法是配置npm的package.json文件,在script里面配置上script{start: webpack},然后在命令行執(zhí)行npm start(或npm run start),實(shí)際上會(huì)執(zhí)行webpack指令,npm會(huì)默認(rèn)加上node_module/.bin/,和上面一樣的效果
2017-02-17
module.exports = {
entry: {
_main: './src/script/main.js',
_list: './src/script/list.js'
},
output: {
path: './dist/js/',
filename: 'bundle.js'
}
}
這樣多個(gè)entry,一個(gè)output我這報(bào)錯(cuò),提示:
Conflict: Multiple assets emit to the same filename bundle.js
貌似不允許多個(gè)入口對(duì)應(yīng)一個(gè)出口
entry: {
_main: './src/script/main.js',
_list: './src/script/list.js'
},
output: {
path: './dist/js/',
filename: 'bundle.js'
}
}
這樣多個(gè)entry,一個(gè)output我這報(bào)錯(cuò),提示:
Conflict: Multiple assets emit to the same filename bundle.js
貌似不允許多個(gè)入口對(duì)應(yīng)一個(gè)出口
2017-02-17
有點(diǎn)聽不懂和難理解 ,覺(jué)得配合 gulp 來(lái)輔助處理會(huì)好一點(diǎn)
2017-02-16