-
Notifications
You must be signed in to change notification settings - Fork 53
Description
The sentry plugin currently uses heuristics to locate sourcemap files for a given bundle file, but in some build configurations this is insufficient. Specifically if the sourcemaps are being written to a separate directory. It would be good to have a hook, similar to sourcemaps.rewriteSources, that would allow you to manually resolve the .map files.
In our specific webpack build we're writing our sourcemaps into a separate directory so they can be bundled up and hosted separately. To do this we configure the SourceMapDevToolPlugin with a custom filename pattern and //# sourceMappingURL line. However, the sentry plugin doesn't know about or understand any of these configs, so it's unable to locate the source map files.
Here's an example of how our solution might look:
module.exports = {
devtool: false,
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: `../sourcemaps/[file].map`,
append: `\n//# sourceMappingURL=${SOURCE_MAP_HOST}/[file].map`,
}),
sentryWebpackPlugin({
sourcemaps: {
resolveSourceMap(bundlePath, sourceMappingUrl) {
return sourceMappingUrl.replace(SOURCE_MAP_HOST, SOURCEMAP_DIR)
}
},
})
]
}Metadata
Metadata
Assignees
Labels
Fields
Give feedbackProjects
Status