-
Notifications
You must be signed in to change notification settings - Fork 102
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
webcomponents-react-seed: big build file size #1269
Comments
I think I found the cause.
|
Hey @Dingyj3178, Let me comment on the individual imports: import 'react-app-polyfill/ie11';
import 'react-app-polyfill/stable';
import '@ui5/webcomponents-base/dist/features/browsersupport/IE11.js';
import '@ui5/webcomponents-react-base/polyfill/IE11'; All those imports are only required for running in IE11. With our next version (0.14.0), we will deprecate IE11 and remove those imports. If you don't need IE11, you can safely remove those. import '@ui5/webcomponents-icons/dist/json-imports/Icons.js'; This import statement is importing all possible Icons. You can omit this "overall" import and import Icons on an individual basis when you us them, e.g. import '@ui5/webcomponents/dist/Assets.js';
import '@ui5/webcomponents-fiori/dist/Assets.js';
import '@ui5/webcomponents-react/dist/Assets'; Those files contain additional themes (e.g. Fiori 3 Dark, Belize, High Contrast Themes) as well as translations. The UI5 Web Components Team is already aware of this "inefficient" bundling and is already working on solution (SAP/ui5-webcomponents#2740) for that. In the meantime if you need e.g. only certain languages, you can also manually import the required files: import { registerI18nBundle } from "@ui5/webcomponents-base/dist/asset-registries/i18n";
import enWebComponentsFiori from "@ui5/webcomponents-fiori/dist/generated/assets/i18n/messagebundle_en.json";
import deWebComponentsFiori from "@ui5/webcomponents-fiori/dist/generated/assets/i18n/messagebundle_de.json";
import enWebComponentsReact from "@ui5/webcomponents-react/dist/assets/i18n/messagebundle_en.json";
import deWebComponentsReact from "@ui5/webcomponents-react/dist/assets/i18n/messagebundle_de.json";
import enWebComponents from "@ui5/webcomponents/dist/generated/assets/i18n/messagebundle_en.json";
import deWebComponents from "@ui5/webcomponents/dist/generated/assets/i18n/messagebundle_de.json";
registerI18nBundle("@ui5/webcomponents", { en: enWebComponents, de: deWebComponents });
registerI18nBundle("@ui5/webcomponents-fiori", { en: enWebComponentsFiori, de: deWebComponentsFiori });
registerI18nBundle("@ui5/webcomponents-react", { en: enWebComponentsReact, de: deWebComponentsReact }); This code snippet would import only the English and German translations and save you a couple of megabytes bundle size. |
Thank you for the kind explanation! BR, |
Hi,
I'm trying to build a demo app by using webcomponents-react-seed.
I found the size of the webcomponents-react-seed build file is too big to accept for loading.
Reprocedure:
1.
npx create-react-app build-test --template @ui5/webcomponents-react-seed
2.
yarn build
3.
as you can see, no source file has 8 MB.

any workaround to reduce the size for production use?
BR,
The text was updated successfully, but these errors were encountered: