Closed cy920820 closed 3 months ago
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.
Do you mean that importing class directly, without using factory (
scene.rexUI.add.xxx
)? Yes, it has. For example, import Label class. (More classes...)