Reactjs 使用react创建js网页包配置
我创建并配置webpack.config.jsReactjs 使用react创建js网页包配置,reactjs,webpack,Reactjs,Webpack,我创建并配置webpack.config.js module.exports = { entry: './src/app/index.js', output: { path: __dirname + '/src/public', filename: 'bundle.js' } }; 在我的package.json中 "scripts": { "webpack": "webpack --mode development" }
module.exports = {
entry: './src/app/index.js',
output: {
path: __dirname + '/src/public',
filename: 'bundle.js'
}
};
在我的package.json中
"scripts": {
"webpack": "webpack --mode development"
}
但在控制台中显示此错误:
ERROR in ./node_modules/destroy/index.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\marle\Desktop\mern-stack\node_modules\destroy'
@ ./node_modules/destroy/index.js 14:17-30
@ ./node_modules/send/index.js
@ ./node_modules/express/lib/response.js
@ ./node_modules/express/lib/express.js
@ ./node_modules/express/index.js
@ ./src/index.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! mern-stack@1.0.0 webpack: `webpack --mode development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the mern-stack@1.0.0 webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\marle\AppData\Roaming\npm-cache\_logs\2019-10-29T23_50_32_004Z-debug.log
我的webpack版本是4.41.2和webpack cli 3.3.9您是否尝试过在webpack配置中设置
目标:节点
。