Skip to content

Commit

Permalink
build(webpack): don't apply process import globally (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
char0n authored Mar 25, 2024
1 parent 1608b8d commit 7efdb99
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions packages/react-scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -460,6 +460,15 @@ module.exports = function (webpackEnv) {
and: [/\.(ts|tsx|js|jsx|md|mdx)$/],
},
},
// Provide explicit import of `process` symbol.
{
test: /@apidevtools\/json-schema-ref-parser\/lib\/util\/url.js$/,
loader: 'imports-loader',
options: {
type: 'commonjs',
imports: ['single process/browser process'],
},
},
{
test: /\.(js|mjs|jsx|ts|tsx)$/,
include: paths.appSrc,
Expand Down Expand Up @@ -856,14 +865,8 @@ module.exports = function (webpackEnv) {
},
}),
new webpack.ProvidePlugin({
process: 'process/browser.js',
Buffer: ['buffer', 'Buffer'],
}),
new webpack.BannerPlugin({
banner: "globalThis.vscode = { process: Symbol.for('vscode') };",
raw: true, // This is important, it tells webpack to prepend the code as-is.
entryOnly: true, // This adds the banner only to the beginning of the bundle.
}),
enableProgressPlugin &&
new webpack.ProgressPlugin({
activeModules: false,
Expand Down

0 comments on commit 7efdb99

Please sign in to comment.