Skip to content

Commit

Permalink
Update ModuleScopePlugin
Browse files Browse the repository at this point in the history
  • Loading branch information
tariqksoliman committed Oct 4, 2023
1 parent 9467d04 commit f5bc3f9
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion configuration/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,15 @@ const postcssNormalize = require("postcss-normalize");

const appPackageJson = require(paths.appPackageJson);

const babelRuntimeEntry = require.resolve("babel-preset-react-app");
const babelRuntimeEntryHelpers = require.resolve(
"@babel/runtime/helpers/esm/assertThisInitialized",
{ paths: [babelRuntimeEntry] }
);
const babelRuntimeRegenerator = require.resolve("@babel/runtime/regenerator", {
paths: [babelRuntimeEntry],
});

// This is a hack so that node v18+ can run.
// "md4" hashes are no longer supported so before everything runs, we override them to be "sha256"
const crypto = require("crypto");
Expand Down Expand Up @@ -285,7 +294,12 @@ module.exports = function (webpackEnv) {
// To fix this, we prevent you from importing files out of src/ -- if you'd like to,
// please link the files into your node_modules/ and let module-resolution kick in.
// Make sure your source files are compiled, as they will not be processed in any way.
new ModuleScopePlugin(paths.appSrc, [paths.appPackageJson]),
new ModuleScopePlugin(paths.appSrc, [
paths.appPackageJson,
babelRuntimeEntry,
babelRuntimeEntryHelpers,
babelRuntimeRegenerator,
]),
],
fallback: {
fs: false,
Expand Down

0 comments on commit f5bc3f9

Please sign in to comment.