-
Notifications
You must be signed in to change notification settings - Fork 22
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
General: Angular bundle reports locale files all being included #1596
Comments
@Sovia @krishollenbeck @pwpatton Looked at this a bit more and i think its probably normal. And possibly whats happening is because the scripts may possibly be used in a dynamic import they are included in the bundle. Here: But they are included as disconnected files / not as a dependency of anything. They just float around in the dist folder until they are needed at runtime you can see they are not part of scripts/polyfills and vendor or main Another hint is that they are listed as lazy chunk files:
So i think this is valid. But if really never used maybe they can be excluded with "exclude" or "ignore" https://stackoverflow.com/questions/44952811/exclude-files-from-build-in-angular-2 or delete from the node_modules. |
do you mean in a dynamic import in the web components themselves? |
Yeah the files are included i think because the web components might need to lazy load them with an import when used. So you can see in the screen shot they are actually just separate files there. Not included in anything else. I figure angular is able to figure out they might be lazy imported so it includes them. If you look at the bundle analyzer they are totally standalone and not included as direct dependencies. |
On further review i think i have an idea that will work. But needs more work so will pick this up next sprint..
loadLanguageScript(value: string) {
const promise = fetch(`../locale-data/${value}-messages.js`);
promise.then(async (response) => {
// do something with the translations
const data = await response.json();
this.loadedLanguages.set(value, data);
});
return promise;
} Down side is some methods of JS in the locale files will need to be moved/ and the translation team will need to agree to support it this way. Plus need to do the conversation. Plus side it may reduce the bundle. Also may need to update enterprise or stop all translations there going forward. Which may be breaking Will send some emails and pick this up next sprint. |
Describe the bug
Noticed with landmark that when using ids-enterprise-wc with angular and analyzing the bundle size, it appears all the locale messages and files are included. But this may be misleading as the appear "disconnected"
To Reproduce
Steps to reproduce the behavior:
npm run build:stats
Expected behavior
Figure out why, if this is a real problem that they are included and can it be fixed.
Screenshots
Additional context
If running the analyzer on the this project it doesnt seem to show that these are included. And removing the assets doesnt make any difference https://github.com/infor-design/enterprise-ng-quickstart/blob/main/angular.json#L38-L47
The text was updated successfully, but these errors were encountered: