Webpack with sourcemap can't resolve variables in production mode

◇◆丶佛笑我妖孽 提交于 2019-12-04 13:43:09

Issues with invalid sourcemaps in Webpack and terser-webpack-plugin are now addressed starting with webpack 4.39.2 and terser-webpack-plugin 1.4.0.

v4.39.0 release log:

webpack-sources + terser-webpack-plugin comes with quality optimizations for SourceMaps

There was an additional issue, whose fix was published later. It was included for webpack-sources v1.4.2/webpack 4.39.2. In conclusion 4.39.2or latest version is the one to go.

Sourcemaps in production mode seem to work as expected in most cases now. Unfortunately, if you have non trivial code transformations like inlining of functions (that exist in source code, but are dissolved from webpack) in the course of uglyfying/minification/optimization, breakpoints sometimes still don't get mapped well. Part of the reason is, that the sourcemap spec is very vague concerning those aspects.

Here is a sample repository, where you can experience breakpoint issues with inlining.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!