假设我有一个使用 Babel 和 Webpack 编译成一个包的前端应用程序,其中包含我拥有的代码的源映射。但是,如果我要查找与第三方依赖项相关的问题,我只会在浏览器调试器中看到它们的缩小代码,因为这是从 NPM 下载并在磁盘上可用的内容。我只能自动重新格式化此代码,但从未看到编写时的原始代码。
除了我的代码的源映射之外,有什么方法可以配置开发环境以提供依赖项代码的源映射吗?
最佳答案
尝试使用 https://github.com/webpack-contrib/source-map-loader
This loader is especially useful when using 3rd-party libraries having their own source maps. If not extracted and processed into the source map of the webpack bundle, browsers may misinterpret source map data. source-map-loader allows webpack to maintain source map data continuity across libraries so ease of debugging is preserved.
关于webpack - 如何在编译包中包含 NPM 依赖项的源映射?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53093008/