Skip to content

Commit 5040f3c

Browse files
hoxyqAndyPengc12
authored andcommitted
fix[devtools/standalone]: update webpack configurations (facebook#26963)
## Summary Overlooked when was working on facebook#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
1 parent a1ba33f commit 5040f3c

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

packages/react-devtools-core/package.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@
2929
"ws": "^7"
3030
},
3131
"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"
3337
}
3438
}

packages/react-devtools-core/webpack.backend.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ process.env.BABEL_CONFIG_ADDITIONAL_TARGETS = JSON.stringify({
3939

4040
module.exports = {
4141
mode: __DEV__ ? 'development' : 'production',
42-
devtool: __DEV__ ? 'cheap-module-eval-source-map' : 'source-map',
42+
devtool: __DEV__ ? 'eval-cheap-module-source-map' : 'source-map',
4343
entry: {
4444
backend: './src/backend.js',
4545
},

packages/react-devtools-core/webpack.standalone.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const babelOptions = {
4747

4848
module.exports = {
4949
mode: __DEV__ ? 'development' : 'production',
50-
devtool: __DEV__ ? 'cheap-module-eval-source-map' : 'source-map',
50+
devtool: __DEV__ ? 'eval-cheap-module-source-map' : 'source-map',
5151
target: 'electron-main',
5252
entry: {
5353
standalone: './src/standalone.js',
@@ -56,8 +56,13 @@ module.exports = {
5656
path: __dirname + '/dist',
5757
filename: '[name].js',
5858
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',
6166
},
6267
resolve: {
6368
alias: {

0 commit comments

Comments
 (0)