Abp: Angular build includes many unexpected _locale*.js files

Created on 5 Aug 2020  路  4Comments  路  Source: abpframework/abp

  • 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?)

breaking change effort-21 effort-3 problem ui-angular

Most helpful comment

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.

All 4 comments

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!

Hi @davidzwa

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

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.

Much obliged!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SmallShrimp picture SmallShrimp  路  3Comments

ugurozturk picture ugurozturk  路  3Comments

derily picture derily  路  3Comments

hikalkan picture hikalkan  路  3Comments

leonkosak picture leonkosak  路  3Comments