Skip to content
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

Replaces Terser/Babel. Improves Build Time #6920

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open

Conversation

marklundin
Copy link
Member

@marklundin marklundin commented Sep 6, 2024

This PR replaces Babel + Terser with SWC which improves the build time of each target.

The same ES5 targets are used for UMD build outputs.

With Terser/Babel ~ 1m40s

created build/playcanvas.js in 9.9s
created build/playcanvas in 6.2s
created build/playcanvas.mjs in 1.3s
created build/playcanvas.dbg.js in 9.8s
created build/playcanvas.dbg in 6s
created build/playcanvas.dbg.mjs in 1.8s
created build/playcanvas.prf.js in 9.4s
created build/playcanvas.prf in 6s
created build/playcanvas.prf.mjs in 1.2s
created build/playcanvas.min.js in 7.5s
created build/playcanvas.min.mjs in 6.4s

With SWC ~ 51s

created build/playcanvas.js in 3.6s
created build/playcanvas in 2.6s
created build/playcanvas.mjs in 1.3s
created build/playcanvas.dbg.js in 3.8s
created build/playcanvas.dbg in 2.6s
created build/playcanvas.dbg.mjs in 1.6s
created build/playcanvas.prf.js in 3.2s
created build/playcanvas.prf in 2.6s
created build/playcanvas.prf.mjs in 1.2s
created build/playcanvas.min.js in 1.9s
created build/playcanvas.min.mjs in 1.4s

I confirm I have read the contributing guidelines and signed the Contributor License Agreement.

@LeXXik
Copy link
Contributor

LeXXik commented Sep 6, 2024

Any change to sizes?

@Maksims
Copy link
Contributor

Maksims commented Sep 6, 2024

Also is there a difference in ECMA compliance, if there is a difference between ES5 versio s, and what it results in?

@marklundin
Copy link
Member Author

marklundin commented Sep 6, 2024 via email

@LeXXik
Copy link
Contributor

LeXXik commented Sep 9, 2024

If it is not possible to bring the build size to what terser is capable of, then we can consider to use this for a debug build, as it is usually the one that takes the most of the time during development and its size is of less importance.

@marklundin
Copy link
Member Author

Below are the file sizes. Will continue investigating

Build Output SWC Babel/Terser
playcanvas.d.ts 1.7MiB 1.7MiB
playcanvas.dbg.js 16MiB 18MiB
playcanvas.dbg.mjs 13MiB 16MiB
playcanvas.js 2.8MiB 2.9MiB
playcanvas.min.js 1.6MiB 1.7MiB
playcanvas.min.mjs 1.6MiB 1.6MiB
playcanvas.mjs 2.7MiB 2.5MiB
playcanvas.prf.js 2.8MiB 2.9MiB
playcanvas.prf.mjs 2.7MiB 2.5MiB

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants