Repository navigation
fix(deploy): bundle framework Workers with Cloudflare module rules and Worker conditions - #540
Open
Pleasurecruise wants to merge 1 commit into
Open
Pleasurecruise wants to merge 1 commit into
Pleasurecruise wants to merge 1 commit into
Conversation
…d Worker conditions The framework Worker bundle now keeps Wasm, data and text imports as Worker modules, as the Cloudflare Vite plugin does, and resolves dependencies with Worker conditions.
This branch has not been deployed
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.
Fixes #539
prepareBundledBuildOutputbundles framework Worker output again with a plain Vite lib build. It now matches@cloudflare/vite-pluginin two ways:.wasmand.wasm?module,.bin,.txt,.htmland.sql, including#subpath imports that resolve to them. Matching imports stay external, and each file is emitted beside the bundle with a path relative to the chunk that imports it.copyBundlealready uploads these files aswasm,dataandtextmodules. The Cloudflare plugin does not export its rules, so the plugin repeats them.WORKER_CONDITIONS, which Void's other Worker bundles already use. The constant moves fromwrapper.tsto its own module so thatcf-build-output.tsstill loads Vite lazily.Both changes apply to every bundle that
prepareBundledBuildOutputbuilds, including the static Worker.Tests
packages/void/test/unit/cf-build-output.test.ts:#subpath import and a dynamic import produceswasm,textanddatamodules and passes thecfdry run.workerdandbrowserexports resolves to itsworkerdbuild.Each test fails when its change is removed.
vp run test,vp run --filter ./packages/void typecheck,vp lintandvp fmt --checkpass.I also prepared the output of a SvelteKit app that uses
@resvg/resvg-wasmand micromark:index_bg.wasmis uploaded as awasmmodule, and the bundle contains the Worker build ofdecode-named-character-reference.