sourcemap 无法在 Angular 2 应用程序上使用 Webpack 在 Firefox 上运行

sourcemap not working on firefox with Webpack on Angular 2 application

我想使用这个 yeoman 生成器创建一个 anuglar 2 应用程序(使用 Webpack):https://github.com/shibbir/generator-angular2-typescript

但我遇到了源地图问题。我无法在 Firefox 控制台上看到 .ts 行号。相反,我看到的是 "link" 类似这样的内容:view-source:http://localhost:3000/app.js line 265 > eval 如果我从控制台单击行号,我会看到一个错误页面,上面写着 Cannot GET /app.js%20line%20265%20%3E%20eval 和一个警报 "The specified line was not found"(这并不奇怪,因为 "file" 只有 1 行长)。
使用这个项目发生了同样的事情:https://github.com/AngularClass/angular2-webpack-starter

在 Chrome 上它们都工作正常并且控制台上的行号正确指向 .ts 文件

在互联网上查找时,我发现 Firefox 上的源映射存在一些错误,但大约是版本 45 左右并且已修复(现在使用 Firefox 49)

您需要 Firefox 50,并且您需要手动启用 Sourcemaps。

At the moment source map support is disabled by default. To enable it, visit about:config, find the preference devtools.sourcemap.locations.enabled and set it to true.

https://developer.mozilla.org/en-US/docs/Tools/Web_Console/Console_messages#Source_maps