且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在 Chrome 开发工具中获取映射 Angular CLI css 文件?

更新时间:2023-09-30 10:23:28

Angular-cli 使用 webpack,但它在/node_modules/angular-cli/models 中有自己的配置文件.

Angular-cli uses webpack, but it comes with its own configuration files in /node_modules/angular-cli/models.

您可以修改它们,但是如果您升级 angular-cli,它将覆盖您的文件.所以一定要备份它们.

You can modify them, but if you upgrade angular-cli it will overwrite your files. So make sure to back them up.

是的,它旨在内联 标签.我同意这看起来很奇怪,应该放在一个单独的文件中,主要是为了用户可以缓存它并减少您的视图块大小.可能是他们认为内联是好的,因为当您处于开发模式时,您不希望它被缓存,这很好,但是在 'ng build' 上,它应该被编译到自己的文件中.

Yes, it is meant to go inline <style> tags. I agree that this seems weird and should be in a separate file, mainly so it can be cached by the user and reduce your views chunk size. It might be that they think inline is good as when you're in development mode you don't want it cached, which is fine, but on 'ng build' it should be compiled to its own file.

我知道你可以使用extract-text-webpack-plugin"来配置 webpack 来做到这一点,但我对它不太熟悉.

I know you can configure webpack to do that using the "extract-text-webpack-plugin", but I am not too familiar with it.

我希望 angular-cli 在构建时这样做,或者在配置中有一个选项.

I would like to see angular-cli do that on build or have an option in the configuration for that.