Skip to content

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

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
1 task
frederic-septeo opened this issue May 5, 2025 · 0 comments · Fixed by #30253
Closed
1 task

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

frederic-septeo opened this issue May 5, 2025 · 0 comments · Fixed by #30253

Comments

@frederic-septeo
Copy link

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

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes angular#30247
alan-agius4 added a commit that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes #30247
alan-agius4 added a commit that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes #30247

(cherry picked from commit b5432b7)
alan-agius4 added a commit that referenced this issue May 6, 2025
…pack browser builder

The `subPath` option was not being properly applied when using the webpack-based browser builder.

Closes #30247

(cherry picked from commit b5432b7)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants