Skip to content

Commit

Permalink
Update source-map regex to not match nested react-refresh-utils packa…
Browse files Browse the repository at this point in the history
…ges (#10348)
  • Loading branch information
bvaughn authored Feb 22, 2024
1 parent 8019d5d commit 20123e6
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,24 @@ const baseNextConfig = {
fs: false,
};

const sourceMapRegExp =
/node_modules.+(immer|@reduxjs|react-resizable-panels|react|react-dom|react-window|suspense|use-context-menu).+\.js$/;
// Source-maps should be uploaded to Next for the following NPM modules
const moduleNames = [
"@reduxjs",
"immer",
"react",
"react-dom",
"react-resizable-panels",
"react-window",
"suspense",
"use-context-menu",
];
const separator = `(\\\\|\\\/)`;
const moduleRegExp = new RegExp(
`node_modules${separator}(${moduleNames.join("|")})${separator}`
);

config.module.rules.push({
test: sourceMapRegExp,
test: moduleRegExp,
enforce: "pre",
use: ["source-map-loader"],
});
Expand Down

0 comments on commit 20123e6

Please sign in to comment.