fix: distribute proper source maps in npm distribution packages (#9877)

Refs #9101
This commit is contained in:
Oliwia Rogala
2024-04-30 11:11:31 +02:00
committed by GitHub
parent b6805e5635
commit 8c90d5d9d0
8 changed files with 14 additions and 17 deletions

View File

@@ -8,7 +8,7 @@ const webpack = require("webpack")
const TerserPlugin = require("terser-webpack-plugin")
const nodeExternals = require("webpack-node-externals")
const { getRepoInfo } = require("./_helpers")
const { getRepoInfo, getDevtool } = require("./_helpers")
const pkg = require("../package.json")
const projectBasePath = path.join(__dirname, "../")
@@ -129,13 +129,7 @@ function buildConfig(
},
},
// If we're mangling, size is a concern -- so use trace-only sourcemaps
// Otherwise, provide heavy souremaps suitable for development
devtool: sourcemaps
? minimize
? "nosources-source-map"
: "cheap-module-source-map"
: false,
devtool: getDevtool(sourcemaps, minimize),
performance: {
hints: "error",
@@ -149,6 +143,7 @@ function buildConfig(
(compiler) =>
new TerserPlugin({
terserOptions: {
sourceMap: sourcemaps,
mangle: !!mangle,
keep_classnames:
!customConfig.mode || customConfig.mode === "production",