【问题标题】:Within ngx-build-plus, how can I determine build configuration?在 ngx-build-plus 中,如何确定构建配置?
【发布时间】:2019-10-31 13:02:00
【问题描述】:

使用 ngx-build-plus 并在自定义插件中,我如何确定从 angular cli build 命令行请求的构建配置?

如果您想知道我将如何使用它,这里是用例: 在根据我选择的构建配置编译我的项目之前,我试图重命名 main.ts 文件 --> 正常构建与 Cordova 构建。 Cordova 构建需要对 main.ts 进行不同的设置,并在 if 语句中包装 platformBrowserDynamic().bootstrapModule(AppModule); 不适用于 web,所以我别无选择,只能使用 2 个不同的 main.ts 文件,我将根据构建类型切换。

【问题讨论】:

    标签: angular angular-cli ngx-build-plus


    【解决方案1】:

    不是最佳答案,但这是一个简单的解决方案。我不需要确定构建配置,因为我可以简单地在命令行中选择不同的自定义插件。

    示例

    为 Cordova 构建时:

    ng build --plugin ~webpack.cordova.js 
    

    正常构建:

    ng build --plugin ~webpack.extra.js
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-22
      • 2011-04-04
      相关资源
      最近更新 更多