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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Angular build includes many unexpected _locale*.js files #4963

Closed
davidzwa opened this issue Aug 5, 2020 · 4 comments · Fixed by #5689
Closed

Angular build includes many unexpected _locale*.js files #4963

davidzwa opened this issue Aug 5, 2020 · 4 comments · Fixed by #5689

Comments

@davidzwa
Copy link

davidzwa commented Aug 5, 2020

  • ABP 3.0.5
  • Angular
  • No relevant logs
  • Steps for reproduction
  • Build Angular

Description:

After having included @abp/ng.core for Angular 9/10, ng build --prod produces a lot of _locale*.js files. I use ngsw and had *.js as a prefetch method, resulting in all locales to be prefetched. I wonder why this many locale files are produced. Can I prevent this or disable this? My app localizes everything from the backend, and I wont probably switch from English anyway as my client does not require localization.

(Or is this an optimization bailout issue and thus not expected behaviour?)

@davidzwa davidzwa changed the title Angular build includes many _locale*.js file Angular build includes many unexpected _locale*.js files Aug 5, 2020
@begandroide
Copy link

Hi! Today i was upgrading ng.abp from 2.9.x to 3.0.5, and then doing a serve/build has a lot of chunk map of _locale, like @davidzwa . Why this change?

image
Regards!

@mehmet-erim
Copy link
Contributor

Hi @davidzwa

We'll work to reduce the locale bundles, thanks for the information.

@mehmet-erim
Copy link
Contributor

BREAKING CHANGE

Many locale files are created as chunk, but as of v3.3, just 10 (ar, cs, en, fr, pt, tr, ru, sl, zl-Hans, zh-Hant) chunks will be created. If the locale of the language you are using is not one of these locales, you should import its locale file in app.module like below:

// nl.js will include the main bundle.

import { storeLocaleData } from '@abp/ng.core';
import(
/* webpackChunkName: "_locale-nl-js"*/
/* webpackMode: "eager" */
'@angular/common/locales/nl.js'
).then(m => storeLocaleData(m.default, 'nl'));

Note: If the Language Management (commercial) module is installed in your project, close to 500 chunks are still being created.

@davidzwa
Copy link
Author

davidzwa commented Oct 4, 2020

Much obliged!

@davidzwa davidzwa closed this as completed Oct 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment