在命令行執行webpack使用的是全局安裝的webpack,會到npm的全局文件夾下去找webpack,如果沒全局安裝 -g(-global),就會報錯.
如果沒全局安裝,可以cd到項目目錄,命令行執行node_module/.bin/webpack hello.js hello.bundle.js.
還有一種方法是配置npm的package.json文件,在script里面配置上script{start: webpack},然后在命令行執行npm start(或npm run start),實際上會執行webpack指令,npm會默認加上node_module/.bin/,和上面一樣的效果
如果沒全局安裝,可以cd到項目目錄,命令行執行node_module/.bin/webpack hello.js hello.bundle.js.
還有一種方法是配置npm的package.json文件,在script里面配置上script{start: webpack},然后在命令行執行npm start(或npm run start),實際上會執行webpack指令,npm會默認加上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'
}
}
這樣多個entry,一個output我這報錯,提示:
Conflict: Multiple assets emit to the same filename bundle.js
貌似不允許多個入口對應一個出口
entry: {
_main: './src/script/main.js',
_list: './src/script/list.js'
},
output: {
path: './dist/js/',
filename: 'bundle.js'
}
}
這樣多個entry,一個output我這報錯,提示:
Conflict: Multiple assets emit to the same filename bundle.js
貌似不允許多個入口對應一個出口
2017-02-17
最贊回答 / jghkjkl_123
webpack hello.js hello.bundle.js --module-bind "css=style-loader!css-loader" ? ?把單引號改成雙引號 就可以?
2017-02-17