Skip to content

Error building localized app with webpack when subPath option is used #30247

Closed

Description

@frederic-septeo

Command

build

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When I build a localized angular application with the "@angular-devkit/build-angular:browser" builder and a subPath configured I get the following error :
Localized bundle generation failed: ENOENT: no such file or directory, open 'C:\......\newAngular\dist\new-angular\en-US\polyfills.7758a3fdbccf54e6.js'

The error occurs with a newly generated angular app and only with a webpack builder. The esbuild builder works fine.

Here is the full angular.json :

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "newAngular": {
      "projectType": "application",
      "schematics": {},
      "root": "",
      "sourceRoot": "src",
      "prefix": "app",
      "i18n": {
        "sourceLocale": {
          "code": "en-US",
          "subPath": ""
        },
        "locales": {}
      },
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/new-angular",
            "index": "src/index.html",
            "main": "src/main.ts",
            "polyfills": [
              "zone.js",
              "@angular/localize/init"
            ],
            "tsConfig": "tsconfig.app.json",
            "assets": [
              {
                "glob": "**/*",
                "input": "public"
              }
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": [],
            "localize": true
          },
          "configurations": {
            "production": {
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "500kB",
                  "maximumError": "1MB"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "4kB",
                  "maximumError": "8kB"
                }
              ],
              "outputHashing": "all"
            },
            "development": {
              "optimization": false,
              "extractLicenses": false,
              "sourceMap": true
            }
          },
          "defaultConfiguration": "production"
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "configurations": {
            "production": {
              "buildTarget": "newAngular:build:production"
            },
            "development": {
              "buildTarget": "newAngular:build:development"
            }
          },
          "defaultConfiguration": "development"
        },
        "extract-i18n": {
          "builder": "@angular-devkit/build-angular:extract-i18n"
        },
        "test": {
          "builder": "@angular-devkit/build-angular:karma",
          "options": {
            "polyfills": [
              "zone.js",
              "zone.js/testing",
              "@angular/localize/init"
            ],
            "tsConfig": "tsconfig.spec.json",
            "assets": [
              {
                "glob": "**/*",
                "input": "public"
              }
            ],
            "styles": [
              "src/styles.css"
            ],
            "scripts": []
          }
        }
      }
    }
  }
}

Minimal Reproduction

Create an empty angular application with ng new.
Set builder to @angular-devkit/build-angular:browser
Add localization package with ng add @angular/localize
Add i18n config in angular.json using the subPath option.
Launch build with ng build

Exception or Error

Localized bundle generation failed: ENOENT: no such file or directory, open 'C:\......\newAngular\dist\new-angular\en-US\polyfills.7758a3fdbccf54e6.js'

Your Environment

Angular CLI: 19.2.10
Node: 20.11.0
Package Manager: npm 10.2.4
OS: win32 x64

Angular: 19.2.9
... common, compiler, compiler-cli, core, forms, localize
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1902.10
@angular-devkit/build-angular   19.2.10
@angular-devkit/core            19.2.10
@angular-devkit/schematics      19.2.10
@angular/cli                    19.2.10
@schematics/angular             19.2.10
rxjs                            7.8.2
typescript                      5.7.3
zone.js                         0.15.0

Anything else relevant?

No response

Activity

  1. added a commit that references this issue on May 6, 2025
    0d3c988
  2. added theissue type on May 6, 2025
  3. added 8 commits that reference this issue on May 6, 2025
    19f1704
    fe9bebf
    b679b85
    cb76b1e
    83b4ee1
    895439b
    28a7f86
    c318ac1
  4. added 3 commits that reference this issue on May 6, 2025
    b5432b7
    9eaf344
    635999d
  5. angular-automatic-lock-bot commented on Jun 6, 2025

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  6. locked and limited conversation to collaborators on Jun 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions