Skip to content

Speed up builds by not bundling typescript - #398

Merged
aomarks merged 1 commit into
mainfrom
faster-build
Mar 20, 2024
Merged

Speed up builds by not bundling typescript#398
aomarks merged 1 commit into
mainfrom
faster-build

Conversation

@justinfagnani

Copy link
Copy Markdown
Contributor

This marks internal/typescript.js as internal in the worker Rollup config, and switches the worker to use modules so it can load the typescript module build.

playground-typescript-worker.js's size goes from 3034427 bytes to 39289 bytes, and the build time on my M1 Pro goes from 26.2s to 4.4s when the typescript bundle is already built.

Module worker support is very good now, at > 96% of tracked users: https://caniuse.com/mdn-api_worker_worker_ecmascript_modules

@justinfagnani
justinfagnani requested a review from aomarks March 20, 2024 16:59

@aomarks aomarks left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@aomarks
aomarks merged commit 2712837 into main Mar 20, 2024
@aomarks
aomarks deleted the faster-build branch March 20, 2024 21:55
@tbroyer

tbroyer commented Oct 16, 2024

Copy link
Copy Markdown

This introduced an (unexpected?) breaking change: the internal/typescript.js now needs to be copied alongside the playground-typescript-worker.js, and when using Rollup with @web/rollup-plugin-import-meta-assets, it has to be manually copied to the assets folder (alongside the worker script that Rollup would have copied itself).

The README needs to be updated to reflect this. See #418

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