Safari console configuration error when sourcemap is unavailable?

Sometimes we want to get the source files from a production server. But we want developers to get these source codes, so there will be some strategy to prevent other people from getting source maps, such as the IP limit for sourcemap requests.

When the source maps are not available, an error message will not be displayed in Chrome and Firefox. But Safari will show 403/404 errors for these source maps.

My question is: is there a way to prevent Safari from showing these messages?

+5
source share
1 answer

If you want to debug your code in Chrome, you can omit the link to the source map so that it is not initially requested at all, and then request the source map manually from the Sources panel of the dev tools.

Webpack has this option:

hidden-source-map - Same as source-map, but does not add a link to the package.

https://webpack.imtqy.com/docs/configuration.html#devtool

The webpack / chrome compiler works well for me. See my question for a detailed description of how to apply a hidden source map.

It might be possible to get hidden source maps using uglify by specifying an empty source-map-url , but I have not tried this.

--source-map-url - The path to the source map will be added to //# sourceMappingURL . The default value passed using --source-map .

https://github.com/mishoo/UglifyJS2

If you need to debug in Safari or Firefox, see the answers here: How to apply a hidden / remote source map in Safari?

-1
source

Source: https://habr.com/ru/post/1239796/


All Articles