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

[Examples] Fix build time getting progressively slower #5873

Merged
merged 7 commits into from Dec 4, 2023

Conversation

kungfooman
Copy link
Collaborator

@kungfooman kungfooman commented Dec 1, 2023

Fixes #5872

Before we had watchers in examples/rollup.config.js that would simply copy build outputs over into /dist/:

    { src: '../build/playcanvas.d.ts', dest: 'dist/playcanvas.d.ts' },
    { src: '../build/playcanvas.js', dest: 'dist/iframe/playcanvas.js' },
    { src: '../build/playcanvas.dbg.js', dest: 'dist/iframe/playcanvas.dbg.js' },
    { src: '../build/playcanvas.prf.js', dest: 'dist/iframe/playcanvas.prf.js' },
    { src: '../build/playcanvas-extras.js', dest: 'dist/iframe/playcanvas-extras.js' },

This worked nice with running npm run develop and if you spawn another shell with target=debug_es5 npm run watch it keeps working for a while aswell, but over time it does more and more, the two rollup processes get in some kind of "create / watch - do stuff / create do stuff again" loop or something.

This can be fixed when we stop putting watchers on build outputs and instead use the rollup target configuration functions (e.g. function buildTarget(buildType, moduleFormat)) directly in examples/rollup.config.js for building the mentioned build outputs.

This is not complicated by itself, but what makes the PR a bit bigger is the separation of a few functions that we need to call from the Examples rollup script.

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

@kungfooman kungfooman marked this pull request as ready for review December 1, 2023 17:25
@mvaligursky
Copy link
Contributor

Nice one @kungfooman , much appreciated. The separation into modules is great!
I'll merge this now and give it a good test over the next few days as I work on some new engine features.

@mvaligursky mvaligursky merged commit e036035 into playcanvas:main Dec 4, 2023
7 checks passed
@mvaligursky
Copy link
Contributor

So far this has worked great, no issues .. and maybe even fixed another issue, where sometimes changes from extras were ignored and I have to manually build extras to get those in again.

@kungfooman
Copy link
Collaborator Author

So far this has worked great, no issues .. and maybe even fixed another issue, where sometimes changes from extras were ignored and I have to manually build extras to get those in again.

🙏 Thank you for testing! It's always hard to tell side effects here and there, so I was prepared that some other issue would suddenly pop up again (Whac-A-Mole 😅)

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

Successfully merging this pull request may close these issues.

[Engine Examples] - local build time gets progressively slower
2 participants