GeezerVison is showing github.com — Create multiple sourcemaps from a single build · Issue #6813 · webpack/webpack
Create multiple sourcemaps from a single build #6813Labels help wantedMaintainers welcome a community PR for thisstatus: staleNo author response after a needs: request; close candidate Description
Do you want to request a feature or report a bug?
feature
What is the current behavior?
Set devtool;. NODE_ENV === PRODUCTION ? 'nosources-source-map' : 'eval-source-map';
Sourcemap type is built.
If the current behavior is a bug, please provide the steps to reproduce.
What is the expected behavior?
If this is a feature request, what is motivation or use case for changing the behavior?
What we'd like is to be able to create multiple sourcemaps for production as a single run.
Set devtool: NODE_ENV === PRODUCTION ? ['nosources-source-map', 'source-map'] : 'eval-source-map';
The first sourcemap will be used client side and included in the the js e.g. //# sourceMappingURL=index.js.map
The second sourcemap would be used for our monitoring system, and would have a filename for example index.js.map2 or anything sensible.
All this would be performed in a single build run.
Perhaps this is already possible and we just haven't discovered how.
Please mention other relevant information such as the browser version, Node.js version, webpack version, and Operating System. Activityooflorent commented on Mar 21, 2018 You could use a multi-config build to achieve this:
if (process.env.NODE_ENV === "production") {
module.exports = [
createConfig({name: "prod1", devtool: "nosources-source-map"}),
createConfig({name: "prod2", devtool: "source-map"}),
]
} else {
module.exports = createConfig({name: "dev", devtool: "eval-source-map"})
}Xotic750 commented on Mar 21, 2018 Thanks, we have tried a multi-config. There have been concerns as to whether each config definitely creates the same final bundle (all my tests indicate that they are, but that is a limited set). Though each build does produce a different hash which is included in the sourcemap), hence a preference to have the sourcemaps created in a single run. There is also the consideration of the time that it takes to bundle our application, twice if we are using multi-config to generate the 2 types of sourcemap that we require.
Just to add that this is for medical solutions, so there is a great deal of red-tape around what is and what isn't allowed, and the high level of concern.
Thanks for any time and consideration. sokra commented on Mar 21, 2018 That's possible. Just use this configuration, or similar:
devtool: "hidden-source-map",
plugins: [
new SourceMapDevtoolPlugin({
filename: "[file].secondary.map",
noSources: true
})
]Reacted by Florent Cailhol Xotic750 commented on Mar 21, 2018 That's great, thanks! I will be sure to try that first thing in the morning. Xotic750 commented on Mar 22, 2018 It looked very promising, I set
devTool: NODE_ENV === PRODUCTION ? 'hidden-source-map' : 'eval-source-map';
plugins: [
new webpack.SourceMapDevToolPlugin({
filename: '[file].map',
noSources: true,
}),
],
output: {
filename: FILENAME,
path: BUILD_DIR,
sourceMapFilename: '[file].monitor.map',
},
2 files were created, the index.js.map was spot on with no source in the map file and only this link was appended to the bundle. The other file index.js.monitor.map was created but the content was:
{"version":3,"sources":[],"names":[],"mappings":"","file":"index.js","sourceRoot":""}
We are using Webpack 3.11.0, the production is being uglified "uglifyjs-webpack-plugin": "^1.2.4" and transpiled "babel-core": "^6.26.0" among other things.
Is this a bug or did I configure it incorrectly?
I see a similar report #6133
I created a minimum reproduction of the problem https://github.com/Xotic750/webpack-multi-sourcemap
I also tried with Webpack 4.2.0 (though I am unable to use this in the products at present) with the same result https://github.com/Xotic750/webpack-multi-sourcemap/tree/webpack-4 Xotic750 commented on Apr 3, 2018 Is there any more information that I can provide to confirm whether this is our configuration problem or a bug? I'd like to get this working, and would even be willing to try and identify the problem in the source if needed. Thanks. alexander-akait commented on May 15, 2018 Xotic750 commented on May 15, 2018 @evilebottnawi Updated both branches linked above.
v3.12.0 same result.
v4.8.3 same result webpack-bot commented on Nov 13, 2018 This issue had no activity for at least half a year.
It's subject to automatic issue closing if there is no activity in the next 15 days. Xotic750 commented on Nov 14, 2018 The problem still exists to the best of my knowledge. The test project is still available at https://github.com/Xotic750/webpack-multi-sourcemap but I have not updated it recently. If it is configuration problem on my part then I would love some guidance to show me where I've gone wrong, equally if this is a problem with webpack then I would love to see it fixed. webpack-bot commented on May 15, 2019 This issue had no activity for at least half a year.
It's subject to automatic issue closing if there is no activity in the next 15 days.
MetadataMetadatahelp wantedMaintainers welcome a community PR for thisstatus: staleNo author response after a needs: request; close candidate StatusShow more project fields
DevelopmentNo branches or pull requestsIssue actions
|