Add assetsOnly/devOnly property to the plugin config - #13985
Conversation
🦋 Changeset detectedLatest commit: a690998 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
✅ All changesets look good |
|
I'm Bonk, and I've done a quick review of your PR. This PR adds a Issue found:
|
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-shared
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-pool-workers
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
2dfbb39 to
83a5849
Compare
c020093 to
d56338c
Compare
|
@edmundhung I've renamed the option to Outputting the assets-only config and modified deploy config when the entry Worker is built would be breaking with the current setup, because in TanStack Start the modified deploy config would break pre-rendering. I plan to do a follow up PR once this one's released that doesn't read the deploy config during pre-rendering. Best to do that in a separate PR as it's a more risky change. Please take another look. |
edmundhung
left a comment
There was a problem hiding this comment.
It looks like you keep checking whether environment is built for now. Is that you plan to fix it all together with the prerendering issue you mentioned?
I am still unsure about the usecase of devOnly in auxiliary workers, but definitely not a blocking concern.
Feel free to merge :)
devOnly property to the plugin configassetsOnly/devOnly property to the plugin config
Replacement for #12788 that makes opting in explicit. This means it doesn't break compatibility with existing framework integrations.
Add
assetsOnly(entry Worker) anddevOnly(auxiliary Workers) options to the plugin configBoth options accept a
booleanor a function that returns aboolean. The function is evaluated lazily at build time, allowing frameworks to provide the value after initialization.Use
assetsOnlyon the entry Worker to skip building the Worker and instead emit an assets-only Wrangler config to the client output directory. This enables frameworks such as Astro to use thessrenvironment during development but produce a fully static app for deployment.Use
devOnlyon an auxiliary Worker to include it duringvite devbut skip it at build time.devOnlyoption to Vite plugin API reference cloudflare-docs#31016A picture of a cute animal (not mandatory, but encouraged)