fix[devtools/standalone]: update webpack configurations (#26963)
## Summary Overlooked when was working on https://github.com/facebook/react/pull/26887. - Added `webpack` packages as dev dependencies to `react-devtools-core`, because it calls webpack to build - Added `process` package as dev dependency, because it is injected with `ProvidePlugin` (otherwise fails with Safari usage) - Updated rule for sourcemaps - Listed required externals for `standalone` build Tested on RN application & Safari
Ruslan Lesiutin committed
Jun 22, 2023 at 08:55 UTC
6c84b505c746cd86bf55bee36faa15240273c2ce
3 files changed
+14
-5
packages/react-devtools-core/package.json
+5
-1
@@ -29,6 +29,10 @@
29
"ws": "^7"
30
},
31
"devDependencies": {
32
- "cross-env": "^3.1.4"
32
+ "cross-env": "^3.1.4",
33
+ "process": "0.11.10",
34
+ "webpack": "^5.82.1",
35
+ "webpack-cli": "^5.1.1",
36
+ "workerize-loader": "^2.0.2"
37
}
38
}
packages/react-devtools-core/webpack.backend.js
+1
-1
@@ -39,7 +39,7 @@ process.env.BABEL_CONFIG_ADDITIONAL_TARGETS = JSON.stringify({
39
40
module.exports = {
41
mode: __DEV__ ? 'development' : 'production',
42
- devtool: __DEV__ ? 'cheap-module-eval-source-map' : 'source-map',
42
+ devtool: __DEV__ ? 'eval-cheap-module-source-map' : 'source-map',
43
entry: {
44
backend: './src/backend.js',
45
},
packages/react-devtools-core/webpack.standalone.js
+8
-3
@@ -47,7 +47,7 @@ const babelOptions = {
47
48
module.exports = {
49
mode: __DEV__ ? 'development' : 'production',
50
- devtool: __DEV__ ? 'cheap-module-eval-source-map' : 'source-map',
50
+ devtool: __DEV__ ? 'eval-cheap-module-source-map' : 'source-map',
51
target: 'electron-main',
52
entry: {
53
standalone: './src/standalone.js',
@@ -56,8 +56,13 @@ module.exports = {
56
path: __dirname + '/dist',
57
filename: '[name].js',
58
chunkFilename: '[name].chunk.js',
59
- library: '[name]',
60
- libraryTarget: 'commonjs2',
59
+ library: {
60
+ type: 'commonjs2',
61
+ },
62
+ },
63
+ externals: {
64
+ bufferutil: 'commonjs bufferutil',
65
+ 'utf-8-validate': 'commonjs utf-8-validate',
66
},
67
resolve: {
68
alias: {