-
Notifications
You must be signed in to change notification settings - Fork 28
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
[RFC] ESM bundling #1109
Comments
Can you please clarify this? |
Yep to override build options etc, otherwise it will just default to some predefined ones. |
As the Editor has the benefits of having UI, this is better to be implemented as UI elements. Otherwise, there are a couple of issues:
|
This work has now been completed. |
Support for ESM bundling
Note
ESM bundling does not attempt to fundamentally rewrite the playcanvas export format. Only what is necessary to have bundled scripts
This is a WIP progress ticket to track and discuss bundling for ESM based projects
As the engine and editor will soon support ES Modules playcanvas/engine#4767, users should be able to export bundled versions of projects with ESM Scripts. This can improve network load by providing optimised builds that end users have control over.
Requirements
Remaining Tasks
User configuration
Update: We've opted for user build configuration to be presented in the export UI dialog as opposed to a separate congfig. This is mainly for UX consistency with how export options are currently presented.
This can be specified using a simplebuild.json
in the root of the project, if none are found we use a pre-defined set of options.Additionally users can define adebug.build.json
used in the launcher. This will allow user to configure different environments depending on the environment.Code Transformation/Transpiling
Bundling will support basic code transformations, starting with minimal initial transforms like stripping debugger statements etc. Over time, we may expand this to include other transformations, such as TypeScript. Each addition will be evaluated on a case by case basis.
However, we don’t plan to support broad code lowering (e.g., Babel et al). Supporting every possible browser target and language feature would be unmanageable. Instead, we’ll focus on a common baseline and let users decide the language features to use specific to their needs. We’re also exploring the option for users to download the project’s source with the same ESM bundler, enabling custom transformations like Babel for local use.
Breaks rest-api-tools
See playcanvas/playcanvas-rest-api-tools#50 for more information
The text was updated successfully, but these errors were encountered: