You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I do not want to expose the full deobfuscated code in production, I do not upload the sourcemaps to our asset server on S3. However, since I do want access to them in our error monitoring tool, I do generate them and upload them separately to Sentry. So the source files end with
but since they are not uploaded to the asset server, that link returns a 404.
This is not too much of an issue but the Chrome Developer Tools can automatically load the asset maps. It sees the sourceMappingURL and downloads it. Since it returns a 404, this prints an error in the console.
hidden-source-map - Same as source-map, but doesn't add a reference comment to the bundle. Useful if you only want SourceMaps to map error stack traces from error reports, but don't want to expose your SourceMap for the browser development tools.
I couldn't find it so I'm proposing to add it. The option hiddenSourceMap would then not write the sourceMappingURL line. This would prevent Chrome Developer Tools from fetching the sourcemaps while still generating them and allowing to separately upload them to an error monitoring tool.
In ember-cli-build.js, it would look something like:
new EmberApp(defaults, {
sourcemaps: {
enabled: true,
hiddenSourceMap: true // defaults to 'false'
}
});
The fast-sourcemap-concat package already has a property mapCommentType (source). One could add support for a value none to achieve this goal with only just a few lines.
Rationale
As I do not want to expose the full deobfuscated code in production, I do not upload the sourcemaps to our asset server on S3. However, since I do want access to them in our error monitoring tool, I do generate them and upload them separately to Sentry. So the source files end with
but since they are not uploaded to the asset server, that link returns a 404.
This is not too much of an issue but the Chrome Developer Tools can automatically load the asset maps. It sees the sourceMappingURL and downloads it. Since it returns a 404, this prints an error in the console.
Proposal
I was looking for an option similar to
hidden-source-map
in WebPack. From https://webpack.js.org/configuration/devtool/#production:I couldn't find it so I'm proposing to add it. The option
hiddenSourceMap
would then not write the sourceMappingURL line. This would prevent Chrome Developer Tools from fetching the sourcemaps while still generating them and allowing to separately upload them to an error monitoring tool.In
ember-cli-build.js
, it would look something like:Implementation
When I go down the chain of dependencies in ember-cli, I see that the sourcemaps are generated in fast-sourcemap-concat. Specifically, if I'm correct, the lines around https://github.com/ef4/fast-sourcemap-concat/blob/d5984e180bbab6fde0c4a5310c776f3119f56f84/lib/source-map.js#L446 write the sourceMappingURL to the source file. The option
hiddenSourceMap
would then be propagated all the way down to this module.I don't mind doing this extension myself but would like to get an OK on the proposal beforehand to avoid doing work for nothing.
The text was updated successfully, but these errors were encountered: