Skip to content

Commit 7efdb99

Browse files
authored
build(webpack): don't apply process import globally (#37)
1 parent 1608b8d commit 7efdb99

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

packages/react-scripts/config/webpack.config.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -460,6 +460,15 @@ module.exports = function (webpackEnv) {
460460
and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
461461
},
462462
},
463+
// Provide explicit import of `process` symbol.
464+
{
465+
test: /@apidevtools\/json-schema-ref-parser\/lib\/util\/url.js$/,
466+
loader: 'imports-loader',
467+
options: {
468+
type: 'commonjs',
469+
imports: ['single process/browser process'],
470+
},
471+
},
463472
{
464473
test: /\.(js|mjs|jsx|ts|tsx)$/,
465474
include: paths.appSrc,
@@ -856,14 +865,8 @@ module.exports = function (webpackEnv) {
856865
},
857866
}),
858867
new webpack.ProvidePlugin({
859-
process: 'process/browser.js',
860868
Buffer: ['buffer', 'Buffer'],
861869
}),
862-
new webpack.BannerPlugin({
863-
banner: "globalThis.vscode = { process: Symbol.for('vscode') };",
864-
raw: true, // This is important, it tells webpack to prepend the code as-is.
865-
entryOnly: true, // This adds the banner only to the beginning of the bundle.
866-
}),
867870
enableProgressPlugin &&
868871
new webpack.ProgressPlugin({
869872
activeModules: false,

0 commit comments

Comments
 (0)