这个怎么解决
来源:3-5 webpack对脚本和样式的处理
慕九州0507976
2018-09-09
bxzdeMacBook-Air:bxz-fe bxz$ webpack
module.js:471
throw err;
^
Error: Cannot find module 'webpack’
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object. (/Users/bxz/bxz/doc/bxz-fe/webpack.config.js:7:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions…js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
2回答
-
Rosen
2018-09-10
webpack 没安装吧,找不到这个包,用指定版本的方式安装上再试试。
npm install webpack@1.15.0 npm install webpack@1.15.0 -g
00 -
慕九州0507976
提问者
2018-09-09
var webpack = require('webpack');
var config = {
entry: {
'index' : ['./src/page/index/index.js'],
'login' : ['./src/page/login/index.js'],
},
output: {
path: './dist',
filename: 'js/[name].js'
},
externals : {
'jquery' : 'window.jQuery'
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name : 'commons',
filename : 'js/base.js'
})
]
};
module.exports = config;
00
相似问题