简体   繁体   English

sourcemap 在 Angular 2 应用程序上使用 Webpack 无法在 firefox 上工作

[英]sourcemap not working on firefox with Webpack on Angular 2 application

I wanted to use this yeoman generator to create an anuglar 2 application (using Webpack): https://github.com/shibbir/generator-angular2-typescript我想使用这个 yeoman 生成器来创建 anuglar 2 应用程序(使用 Webpack): https : //github.com/shibbir/generator-angular2-typescript

But i'm having an issue with sourcemaps.但是我在使用源映射时遇到了问题。 I'm not able to see .ts line numbers on Firefox console.我无法在 Firefox 控制台上看到 .ts 行号。 What i see instead is a "link" to something like this: view-source:http://localhost:3000/app.js line 265 > eval If i click on the line number from the console i get to an error page saying Cannot GET /app.js%20line%20265%20%3E%20eval and an alert "The specified line was not found" (which is not surprising since the "file" is only 1 line long).我看到的是这样一个“链接”: view-source:http://localhost:3000/app.js line 265 > eval如果我点击控制台中的行号,我会看到一个错误页面Cannot GET /app.js%20line%20265%20%3E%20eval和警报“未找到指定的行”(这并不奇怪,因为“文件”只有 1 行长)。
The same thing happened using this project: https://github.com/AngularClass/angular2-webpack-starter使用这个项目也发生了同样的事情: https : //github.com/AngularClass/angular2-webpack-starter

On Chrome they both work fine and the line numbers on the console point correctly to the .ts file在 Chrome 上,它们都可以正常工作,并且控制台上的行号正确指向 .ts 文件

Looking on the internet i've found there were some bugs on Firefox with sourcemaps but it was about version 45 or so and it was fixed (using Firefox 49 now)在互联网上查看我发现 Firefox 上有一些带有源映射的错误,但它大约是 45 版左右,并且已修复(现在使用 Firefox 49)

You need Firefox 50 , and you need to manually enable Sourcemaps.您需要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 .要启用它,请访问about:config ,找到首选项devtools.sourcemap.locations.enabled并将其设置为true

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM