【问题标题】:How to add angular builder/custom webpack for different environment?如何为不同的环境添加角度构建器/自定义 webpack?
【发布时间】:2021-09-07 06:53:41
【问题描述】:

目前我在 angular.json 文件中使用“服务”的自定义构建器,像这样

"serve": {
          "builder": "@angular-builders/custom-webpack:dev-server",
          "options": {
            "browserTarget": "app:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "app:build:production"
            },
            "qa": {
              "browserTarget": "app:build:qa"
            },
            "local": {
              "browserTarget": "app:build:local"
            },
}

我也尝试在“本地”中添加构建器选项,但它不起作用 ,那么有没有办法为“本地服务”添加这个构建器?

【问题讨论】:

    标签: angular angular-cli webpack-dev-server angular-builder


    【解决方案1】:

    你可以直接在architect下添加>build为所有环境启用:

    "architect": {
        "build": {
            "builder": "@angular-builders/custom-webpack:browser",
            "options": {
                "customWebpackConfig": {
                    "path": "./webpack.config.js",
                    "replaceDuplicatePlugins": true
                },
             ....
    

    【讨论】:

      猜你喜欢
      • 2020-11-20
      • 1970-01-01
      • 2022-02-03
      • 2020-05-22
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-11-20
      • 2020-10-17
      相关资源
      最近更新 更多