playcanvas / editor

Issue tracker for the PlayCanvas Editor
https://playcanvas.com/
155 stars 28 forks source link

Editor front end build process update #781

Closed ellthompson closed 1 year ago

ellthompson commented 2 years ago

The editor build process currently involves concatenating a set of front end scripts together, which is output here. These scripts contain a mix of ES6 and ES5 syntax and any script dependencies are shared using the browsers global namespace.

I am proposing that we introduce a JS bundler to the editors build process, giving us more control over how we build it's front end. It would enable us to make the following changes to the build:

To keep the editor consistent with our open source projects, rollup can be used as the bundler.

The introduction of this build process should not drastically change the output of the editor.js file as I imagine the initial update would maintain the current structure of the code base, with scripts depending on globally defined variables. However with the introduction of ESModules, it will be possible to slowly remove all of these global dependencies from the codebase over time. This could have an impact on external editor scripts / extensions which depend on certain global variables. It would be important during this transition that any extensions use only on our open source offerings (editor-api / pcui etc), where any breaking changes can be tracked.

ellthompson commented 1 year ago

Closing this issue as the editor front end now utilises ESModules and a rollup based build process.