Does UI component support on-demand introduction?
cy920820 opened this issue · comments
Do you mean that importing class directly, without using factory (scene.rexUI.add.xxx
)?
Yes, it has. For example, import Label class. (More classes...)
Will unused components be packaged into the project, eventually increasing the size of the application?
It depends on bundle tool like rollup, or webpack. Usually they can include imported module/class only.
BTW, factory (scene.rexUI.add.xxx
) solution will include all of them in rexui plugin.
I just want to package the UI components used to prevent the project volume from increasing
You can import class directly like
import { Label } from 'phaser3-rex-plugins/templates/ui/ui-components.js';
thanks bro
You can import class directly like
import { Label } from 'phaser3-rex-plugins/templates/ui/ui-components.js';
I am using the vite build tool, so I think it should be dynamic import
const { Label } = await import('phaser3-rex-plugins/templates/ui/ui-components.js');
Is that so?
I did not use await import(...)
in my test environment, sorry can't help you.