webpack-plugin-hash-output
webpack-plugin-hash-output copied to clipboard
Usage with devtool: "hidden-source-map"
Thanks for making this plugin!
It's co common to use devtool: "hidden-source-map"
in production. However, the problem with this use case is this plugin doesn't rename the final source map filename to match the final chunk asset filename. Usually when mapping stack traces server-side, the assumption is the source map filename is always x.js.map
where the associated js file is x.js
.
For "hidden-source-map" usage, it would be nice if this plugin renamed the source map filename to match the final chunk asset name.
Perhaps this could be an option/config. Happy to work on a PR and tests for this if that makes sense to you.
The reason we don't rename sourcemaps is because they create a circular dependency: the .js
file contains a reference to the sourcemap, and the sourcemap contains a reference to the .js
file.
Maybe there is a solution I don't see, feel free to try fixing it :)
With sourcemap: “hidden”, the .js
doesn’t reference the map; the comment is omitted.
Sorry, I read your message to quickly :( You are right. With hidden-source-map this should work.
We probably don't need a config option: we can scan the .js
source looking for the name of the sourcemap. If not found, then we can assume there is not a circular dependency and we can rename both. That way this will work for hidden-source-map
or any other future devtool
option that generates sourcemaps without circular dependencies.
What do you think?
Wouldn't this be solved by #28?
Is there a workaround for this?