convert inline worker generation to a post-processing step#449
Open
convert inline worker generation to a post-processing step#449
Conversation
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
…labs/motion-tools into make-worker-transform-post-process
…rker-transform-post-process
…rker-transform-post-process
mattmacf98
approved these changes
Apr 2, 2026
Contributor
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Web workers using
new Worker(new URL('./worker.js', import.meta.url))break when consumed as a library because Vite's dep optimizer moves the package to .vite/deps/ but the worker file doesn't follow.This PR switches from pre-generating inlined worker files in
src/libto post-processingdist/aftersvelte-package.src/lib/loaders/pcd/index.tsreverted to standardnew Worker(new URL(...))syntaxscripts/post-process-workers.jsruns aftersvelte-package, bundles workers withesbuild, and rewritesdist/to useBlobURLsscripts/README.mddocumenting both build scriptsThe previous approach (pre-generating
worker.inline.tsbeforesvelte-package) required running a build step before check, didn't support HMR for worker changes in dev, and left generated files in the source tree. Post-processingdist/solves all three: dev mode works natively with Vite, CI runscheckwithout a pre-build, and the source stays clean.I tested running locally, and the changes were reflected in HMR. By running
pnpm previewandmake upin the environments, I was able to file-drop a PCD and load it.