angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.97k forks source link

extract-i18n performance issues #28597

Closed Carlosamouco closed 2 weeks ago

Carlosamouco commented 2 weeks ago

Command

extract-i18n

Description

After installing https://www.npmjs.com/package/stimulsoft-reports-js, I noticed that ng extract-i18n became very slow, from approx. 1 minute to almost 4 minutes. This package is very large, and I suspect that it is taking so long because the extract-i18n command is trying to look for messages in the whole chunk that contains this dependency.

Describe the solution you'd like

Could there be a way to make the tool skip analyzing third-party dependencies that have nothing to do with angular? For example, create a list of dependencies to skip?

Describe alternatives you've considered

Since I am not using any third party angular libraries, I am considering extracting the messages directly from the source code using a ts parser.

alan-agius4 commented 2 weeks ago

You can mark that specific library via another build configuration.

"architect": {
"build": {
  "builder": "@angular-devkit/build-angular:application",
  "configurations": {
    "development": {},
    "i18n-extract": {
      "externalDependencies": ["my-deps"]
    },
    "production": {
    }
  },
  ...
},
"extract-i18n": {
  "builder": "@angular-devkit/build-angular:extract-i18n",
  "options": {
    "buildTarget": "my-project:build:production,i18n-extract",
    "outputPath": "locales"
  }
},