Skip to content

Commit

Permalink
Adjust webpack config to webpack 5 node polyfill removal
Browse files Browse the repository at this point in the history
  • Loading branch information
andriijas committed Dec 19, 2019
1 parent 9c9e5b3 commit 7864e52
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
3 changes: 3 additions & 0 deletions packages/react-error-overlay/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,8 @@
"/fixtures/",
"setupJest.js"
]
},
"dependencies": {
"path-browserify": "^1.0.0"
}
}
2 changes: 1 addition & 1 deletion packages/react-error-overlay/src/utils/unmapper.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import StackFrame from './stack-frame';
import { getSourceMap } from './getSourceMap';
import { getLinesAround } from './getLinesAround';
import path from 'path';
import path from 'path-browserify';

function count(search: string, string: string): number {
// Count starts at -1 because a do-while loop always runs at least once
Expand Down
9 changes: 5 additions & 4 deletions packages/react-error-overlay/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,11 @@ module.exports = {
optimization: {
nodeEnv: false,
},
node: {
fs: 'empty',
process: false,
},
// todo: Update before final webpack 5 release
// node: {
// fs: 'empty',
// process: false,
// },
performance: {
hints: false,
},
Expand Down
21 changes: 11 additions & 10 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -726,16 +726,17 @@ module.exports = function(webpackEnv) {
].filter(Boolean),
// Some libraries import Node modules but don't use them in the browser.
// Tell Webpack to provide empty mocks for them so importing them works.
node: {
module: 'empty',
dgram: 'empty',
dns: 'mock',
fs: 'empty',
http2: 'empty',
net: 'empty',
tls: 'empty',
child_process: 'empty',
},
// todo: Update before final webpack 5 release
// node: {
// module: 'empty',
// dgram: 'empty',
// dns: 'mock',
// fs: 'empty',
// http2: 'empty',
// net: 'empty',
// tls: 'empty',
// child_process: 'empty',
// },
// Turn off performance processing because we utilize
// our own hints via the FileSizeReporter
performance: false,
Expand Down

0 comments on commit 7864e52

Please sign in to comment.