Skip to content
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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrading to angular v13 causes webpack-dev-server to ignore translation string changes #22751

Closed
nkrmavnar opened this issue Feb 23, 2022 · 10 comments

Comments

@nkrmavnar
Copy link

nkrmavnar commented Feb 23, 2022

馃悶 Bug report

After upgrading to Angular v13, webpack-dev-server started ignoring translation string changes and therefore does not reload the page as it does when eg. a component template is changed. This feature worked in Angular v12.2.13.

Dependencies (package.json):

{
  "name": "frontend",
  "version": "0.0.0",
  "engines": {
    "node": ">=16.0.0",
    "npm": ">=7.0.0"
  },
  "scripts": {
    "start": "ng serve"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "13.2.3",
    "@angular/common": "13.2.3",
    "@angular/compiler": "13.2.3",
    "@angular/core": "13.2.3",
    "@angular/forms": "13.2.3",
    "@angular/platform-browser": "13.2.3",
    "@angular/platform-browser-dynamic": "13.2.3",
    "@angular/router": "13.2.3",
    ...
    "@ngx-translate/core": "14.0.0"
    ...
  },
  "devDependencies": {
    "@angular-builders/jest": "12.1.2",
    "@angular-devkit/build-angular": "13.2.4",
    "@angular-eslint/eslint-plugin": "12.6.1",
    "@angular/cli": "13.2.4",
    "@angular/compiler-cli": "13.2.3",
    "@angular/language-service": "13.2.3",
    ...
  }
}

angular.json:

{
  "$schema": "./node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "newProjectRoot": "apps",
  "projects": {
    "admin": {
      "projectType": "application",
      "schematics": {
        "@schematics/angular:component": {
          "style": "less"
        }
      },
      "root": "",
      "sourceRoot": "apps/admin",
      "prefix": "admin",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/admin",
            "index": "apps/admin/index.html",
            "main": "apps/admin/main.ts",
            "polyfills": "apps/admin/polyfills.ts",
            "tsConfig": "apps/admin/tsconfig.app.json",
            "assets": ["apps/admin/assets"],
            "styles": ["apps/admin/styles/styles.less"],
            "stylePreprocessorOptions": {
              "includePaths": ["apps", "node_modules"]
            },
            "scripts": [],
            "allowedCommonJsDependencies": [],
            "vendorChunk": true,
            "extractLicenses": false,
            "buildOptimizer": false,
            "sourceMap": true,
            "optimization": false,
            "namedChunks": true
          },
          "configurations": {
            "production": {
              "baseHref": "/admin/",
              "deployUrl": "/admin/",
              "optimization": {
                "scripts": true,
                "styles": {
                  "minify": true,
                  "inlineCritical": false
                },
                "fonts": true
              },
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "2mb",
                  "maximumError": "5mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ]
            },
            "development": {
              "baseHref": "/admin/",
              "deployUrl": "/admin/",
              "budgets": [
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "6kb"
                }
              ],
              "fileReplacements": [
                {
                  "replace": "apps/admin/environments/environment.ts",
                  "with": "apps/admin/environments/environment.dev.ts"
                }
              ]
            }
          },
          "defaultConfiguration": ""
        },
       ...
      }
    }
  }
}

Sample translations file (en-US.json):
Before the change:

{
  "sideMenu": {
    "menuItem1": "Menu Item 1",
    "menuItem2": "Menu Item 2"
  }
}

After the change:

{
  "sideMenu": {
    "menuItem1": "Menu Item 1",
    "menuItem2": "Menu Item 2 - changed"
  }
}

Log after the change:

[webpack-dev-server] App updated. Recompiling...
index.js:551 [webpack-dev-server] Nothing changed.

Issue is similar to the one described here:
https://stackoverflow.com/questions/71143761/angular-13-webpack-dev-server-dont-reload-application-after-change-transloco-n

@alan-agius4
Copy link
Collaborator

This seems to be an issue with webpack-dev-server or copy-webpack-plugin where when assets are updated live-reload is not triggered.

@alan-agius4
Copy link
Collaborator

Can you please provide the output of ng version?

@nkrmavnar
Copy link
Author

Can you please provide the output of ng version?

Sure. See below.

Angular CLI: 13.2.4
Node: 16.10.0
Package Manager: npm 7.24.0
OS: darwin x64

Angular: 13.2.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1302.4
@angular-devkit/build-angular   13.2.4
@angular-devkit/core            8.3.29
@angular-devkit/schematics      8.3.29
@angular/cli                    13.2.4
@schematics/angular             8.3.29
rxjs                            6.6.7
typescript                      4.5.5

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Mar 4, 2022

Opened an upstream issue webpack-contrib/copy-webpack-plugin#674

@nkrmavnar
Copy link
Author

@alan-agius4 any update about this issue?

@alan-agius4
Copy link
Collaborator

Unfortunately, it was not yet fixed upstream. See: webpack-contrib/copy-webpack-plugin#674

@Mylogin-info
Copy link

Same issue. Any fix/workaround available?

@alan-agius4
Copy link
Collaborator

@Mylogin-info, this is an upstream issue with isn't actionable from our end. Please subscribe to webpack-contrib/copy-webpack-plugin#674

@alan-agius4
Copy link
Collaborator

Closing as this is not actionable from our end. Please continue watching this webpack-dev-server issue.

@alan-agius4 alan-agius4 closed this as not planned Won't fix, can't repro, duplicate, stale Jun 14, 2022
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants