angular-cli中的DefaultEncapsulation --prod

时间:2017-06-05 22:35:05

标签: angular angular-cli

我使用angular-cli命令ng new MyProject创建了一个基本应用程序并禁用全局视图封装我通过添加defaultEncapsulation来更改main.ts文件:bootstrapModule(AppModule,{ defaultEncapsulation: ViewEncapsulation.None })

如果我使用ng serve启动应用程序,它会完美运行,但如果我使用ng serve --prod,我的配置将被忽略,应用程序将使用ViewEncapsulation.Emulated(我可以看到_ngcontent属性)开发工具)。知道我错过了什么以及如何在prod构建中设置ViewEncapsulation.None?我使用angular 4.1.3和angular-cli 1.0.0。

更新 如果我使用ng serve --prod --aot=false构建应用程序,我的配置也会受到尊重,因此它与aot有关。

0 个答案:

没有答案