组内同学反馈编译报错
Module not found: Error: Can't resolve 'process/browser' in '/Users/sunxiongying/Documents/project/netease/oppo/web-session/node_modules/@ysf/wxwork-accounts/node_modules/axios/lib'
Did you mean 'browser.js'?
BREAKING CHANGE: The request 'process/browser' failed to resolve only because it was resolved as fully specified
(probably because the origin is strict EcmaScript Module, e. g. a module with javascript mimetype, a '*.mjs' file, or a '*.js' file where the package.json contains '"type": "module"').
解决方案
- npm i process
- 写一下webpack.config.js配置
我是这个方案解决的。当然文章中还有提到其他方案,如果其他方案可解,麻烦大家通知我一下
module.exports = {
// 其他配置...
resolve: {
fallback: {
"process/browser": require.resolve("process/browser"),
},
},
};
解法来源: