diff --git a/packages/react-router-config/package.json b/packages/react-router-config/package.json index 813274d6bc..ccdefdec7e 100644 --- a/packages/react-router-config/package.json +++ b/packages/react-router-config/package.json @@ -13,6 +13,8 @@ "esm", "index.js", "matchRoutes.js", + "modules/*.js", + "modules/utils/*.js", "renderRoutes.js", "warnAboutDeprecatedCJSRequire.js", "umd" diff --git a/packages/react-router-config/rollup.config.js b/packages/react-router-config/rollup.config.js index ae2323fb84..38aeb7a9e7 100644 --- a/packages/react-router-config/rollup.config.js +++ b/packages/react-router-config/rollup.config.js @@ -16,19 +16,24 @@ function isBareModuleId(id) { const cjs = [ { input: "modules/index.js", - output: { file: `cjs/${pkg.name}.js`, format: "cjs", esModule: false }, + output: { + file: `cjs/${pkg.name}.js`, + sourcemap: true, + format: "cjs", + esModule: false + }, external: isBareModuleId, plugins: [ - babel({ exclude: /node_modules/ }), + babel({ exclude: /node_modules/, sourceMaps: true }), replace({ "process.env.NODE_ENV": JSON.stringify("development") }) ] }, { input: "modules/index.js", - output: { file: `cjs/${pkg.name}.min.js`, format: "cjs" }, + output: { file: `cjs/${pkg.name}.min.js`, sourcemap: true, format: "cjs" }, external: isBareModuleId, plugins: [ - babel({ exclude: /node_modules/ }), + babel({ exclude: /node_modules/, sourceMaps: true }), replace({ "process.env.NODE_ENV": JSON.stringify("production") }), uglify() ] @@ -38,11 +43,12 @@ const cjs = [ const esm = [ { input: "modules/index.js", - output: { file: `esm/${pkg.name}.js`, format: "esm" }, + output: { file: `esm/${pkg.name}.js`, sourcemap: true, format: "esm" }, external: isBareModuleId, plugins: [ babel({ exclude: /node_modules/, + sourceMaps: true, runtimeHelpers: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), @@ -58,6 +64,9 @@ const umd = [ input: "modules/index.js", output: { file: `umd/${pkg.name}.js`, + sourcemap: true, + sourcemapPathTransform: relativePath => + relativePath.replace(/^.*?\/node_modules/, "../../node_modules"), format: "umd", name: "ReactRouterConfig", globals @@ -67,6 +76,7 @@ const umd = [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), nodeResolve(), @@ -79,6 +89,9 @@ const umd = [ input: "modules/index.js", output: { file: `umd/${pkg.name}.min.js`, + sourcemap: true, + sourcemapPathTransform: relativePath => + relativePath.replace(/^.*?\/node_modules/, "../../node_modules"), format: "umd", name: "ReactRouterConfig", globals @@ -88,6 +101,7 @@ const umd = [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), nodeResolve(), diff --git a/packages/react-router-dom/package.json b/packages/react-router-dom/package.json index 318c4c1a19..4fb857605c 100644 --- a/packages/react-router-dom/package.json +++ b/packages/react-router-dom/package.json @@ -26,6 +26,8 @@ "index.js", "generatePath.js", "matchPath.js", + "modules/*.js", + "modules/utils/*.js", "withRouter.js", "warnAboutDeprecatedCJSRequire.js", "umd" diff --git a/packages/react-router-dom/rollup.config.js b/packages/react-router-dom/rollup.config.js index 1680977e24..f665d141c4 100644 --- a/packages/react-router-dom/rollup.config.js +++ b/packages/react-router-dom/rollup.config.js @@ -16,19 +16,24 @@ function isBareModuleId(id) { const cjs = [ { input: "modules/index.js", - output: { file: `cjs/${pkg.name}.js`, format: "cjs", esModule: false }, + output: { + file: `cjs/${pkg.name}.js`, + sourcemap: true, + format: "cjs", + esModule: false + }, external: isBareModuleId, plugins: [ - babel({ exclude: /node_modules/ }), + babel({ exclude: /node_modules/, sourceMaps: true }), replace({ "process.env.NODE_ENV": JSON.stringify("development") }) ] }, { input: "modules/index.js", - output: { file: `cjs/${pkg.name}.min.js`, format: "cjs" }, + output: { file: `cjs/${pkg.name}.min.js`, sourcemap: true, format: "cjs" }, external: isBareModuleId, plugins: [ - babel({ exclude: /node_modules/ }), + babel({ exclude: /node_modules/, sourceMaps: true }), replace({ "process.env.NODE_ENV": JSON.stringify("production") }), uglify() ] @@ -38,12 +43,13 @@ const cjs = [ const esm = [ { input: "modules/index.js", - output: { file: `esm/${pkg.name}.js`, format: "esm" }, + output: { file: `esm/${pkg.name}.js`, sourcemap: true, format: "esm" }, external: isBareModuleId, plugins: [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), sizeSnapshot() @@ -58,6 +64,9 @@ const umd = [ input: "modules/index.js", output: { file: `umd/${pkg.name}.js`, + sourcemap: true, + sourcemapPathTransform: relativePath => + relativePath.replace(/^.*?\/node_modules/, "../../node_modules"), format: "umd", name: "ReactRouterDOM", globals @@ -67,6 +76,7 @@ const umd = [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), nodeResolve(), @@ -86,6 +96,9 @@ const umd = [ input: "modules/index.js", output: { file: `umd/${pkg.name}.min.js`, + sourcemap: true, + sourcemapPathTransform: relativePath => + relativePath.replace(/^.*?\/node_modules/, "../../node_modules"), format: "umd", name: "ReactRouterDOM", globals @@ -95,6 +108,7 @@ const umd = [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), nodeResolve(), diff --git a/packages/react-router/package.json b/packages/react-router/package.json index 66499b639e..246bac32b8 100644 --- a/packages/react-router/package.json +++ b/packages/react-router/package.json @@ -22,6 +22,8 @@ "index.js", "generatePath.js", "matchPath.js", + "modules/*.js", + "modules/utils/*.js", "withRouter.js", "warnAboutDeprecatedCJSRequire.js", "umd" diff --git a/packages/react-router/rollup.config.js b/packages/react-router/rollup.config.js index 68a0e91ef4..b5c10441cc 100644 --- a/packages/react-router/rollup.config.js +++ b/packages/react-router/rollup.config.js @@ -16,10 +16,15 @@ function isBareModuleId(id) { const cjs = [ { input: "modules/index.js", - output: { file: `cjs/${pkg.name}.js`, format: "cjs", esModule: false }, + output: { + file: `cjs/${pkg.name}.js`, + sourcemap: true, + format: "cjs", + esModule: false + }, external: isBareModuleId, plugins: [ - babel({ exclude: /node_modules/ }), + babel({ exclude: /node_modules/, sourceMaps: true }), replace({ "process.env.NODE_ENV": JSON.stringify("development"), "process.env.BUILD_FORMAT": JSON.stringify("cjs") @@ -28,10 +33,10 @@ const cjs = [ }, { input: "modules/index.js", - output: { file: `cjs/${pkg.name}.min.js`, format: "cjs" }, + output: { file: `cjs/${pkg.name}.min.js`, sourcemap: true, format: "cjs" }, external: isBareModuleId, plugins: [ - babel({ exclude: /node_modules/ }), + babel({ exclude: /node_modules/, sourceMaps: true }), replace({ "process.env.NODE_ENV": JSON.stringify("production"), "process.env.BUILD_FORMAT": JSON.stringify("cjs") @@ -44,12 +49,13 @@ const cjs = [ const esm = [ { input: "modules/index.js", - output: { file: `esm/${pkg.name}.js`, format: "esm" }, + output: { file: `esm/${pkg.name}.js`, sourcemap: true, format: "esm" }, external: isBareModuleId, plugins: [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), replace({ "process.env.BUILD_FORMAT": JSON.stringify("esm") }), @@ -65,6 +71,9 @@ const umd = [ input: "modules/index.js", output: { file: `umd/${pkg.name}.js`, + sourcemap: true, + sourcemapPathTransform: relativePath => + relativePath.replace(/^.*?\/node_modules/, "../../node_modules"), format: "umd", name: "ReactRouter", globals @@ -74,6 +83,7 @@ const umd = [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), nodeResolve(), @@ -94,6 +104,9 @@ const umd = [ input: "modules/index.js", output: { file: `umd/${pkg.name}.min.js`, + sourcemap: true, + sourcemapPathTransform: relativePath => + relativePath.replace(/^.*?\/node_modules/, "../../node_modules"), format: "umd", name: "ReactRouter", globals @@ -103,6 +116,7 @@ const umd = [ babel({ exclude: /node_modules/, runtimeHelpers: true, + sourceMaps: true, plugins: [["@babel/transform-runtime", { useESModules: true }]] }), nodeResolve(),