Skip to content

Commit

Permalink
fix[devtools/standalone]: update webpack configurations (#26963)
Browse files Browse the repository at this point in the history
## Summary
Overlooked when was working on
#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
  • Loading branch information
hoxyq authored Jun 22, 2023
1 parent 794b770 commit 6c84b50
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 5 additions & 1 deletion packages/react-devtools-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
"ws": "^7"
},
"devDependencies": {
"cross-env": "^3.1.4"
"cross-env": "^3.1.4",
"process": "0.11.10",
"webpack": "^5.82.1",
"webpack-cli": "^5.1.1",
"workerize-loader": "^2.0.2"
}
}
2 changes: 1 addition & 1 deletion packages/react-devtools-core/webpack.backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ process.env.BABEL_CONFIG_ADDITIONAL_TARGETS = JSON.stringify({

module.exports = {
mode: __DEV__ ? 'development' : 'production',
devtool: __DEV__ ? 'cheap-module-eval-source-map' : 'source-map',
devtool: __DEV__ ? 'eval-cheap-module-source-map' : 'source-map',
entry: {
backend: './src/backend.js',
},
Expand Down
11 changes: 8 additions & 3 deletions packages/react-devtools-core/webpack.standalone.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const babelOptions = {

module.exports = {
mode: __DEV__ ? 'development' : 'production',
devtool: __DEV__ ? 'cheap-module-eval-source-map' : 'source-map',
devtool: __DEV__ ? 'eval-cheap-module-source-map' : 'source-map',
target: 'electron-main',
entry: {
standalone: './src/standalone.js',
Expand All @@ -56,8 +56,13 @@ module.exports = {
path: __dirname + '/dist',
filename: '[name].js',
chunkFilename: '[name].chunk.js',
library: '[name]',
libraryTarget: 'commonjs2',
library: {
type: 'commonjs2',
},
},
externals: {
bufferutil: 'commonjs bufferutil',
'utf-8-validate': 'commonjs utf-8-validate',
},
resolve: {
alias: {
Expand Down

0 comments on commit 6c84b50

Please sign in to comment.