Replies: 1 comment
-
|
You can exclude specific packages from source map processing using the // rspack.config.js
module.exports = {
module: {
rules: [
{
test: /\.js$/,
include: /node_modules\/problematic-package/,
enforce: "pre",
use: [
{
loader: "source-map-loader",
options: {
filterSourceMappingUrl: () => false, // Disable source map loading
},
},
],
},
],
},
};Or to disable input source maps globally, you can configure the devtool option to only generate new maps without consuming existing ones: module.exports = {
devtool: "source-map", // or false to disable entirely
// Prevent loading .map files from node_modules
module: {
rules: [
{
test: /\.js$/,
include: /node_modules/,
enforce: "pre",
loader: "source-map-loader",
options: {
filterSourceMappingUrl: (url, resourcePath) => {
// Return false to ignore source maps from specific packages
if (resourcePath.includes("problematic-package")) {
return false;
}
return true;
},
},
},
],
},
};This gives you fine-grained control over which packages' source maps to include. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Let's say there is a npm package that ship with some compiled js:
When this package is imported by some source code, rspack automatically pick up the
.mapfile, which is awesome.However in some cases source maps in the package are not usable enough. That may caused by having full path in the map, or having "webpack://" prefix in the paths, or the map is corrupted. And when analyzing package size with source-map-explorer, the input source map may make its result harder to read, since I'm looking into the source sizes of a package that I don't care.
It's something like webpack without source-map-loader. Is there anyway to achieve this? Thanks a lot!
Beta Was this translation helpful? Give feedback.
All reactions