Skip to content

fix(cloudflare): make vite main authoritative over an app-declared entry input - #1410

Open
filipfalcon wants to merge 1 commit into
alchemy-run:mainfrom
filipfalcon:fix/cloudflare-vite-main-authoritative
Open

fix(cloudflare): make vite main authoritative over an app-declared entry input#1410
filipfalcon wants to merge 1 commit into
alchemy-run:mainfrom
filipfalcon:fix/cloudflare-vite-main-authoritative

Conversation

@filipfalcon

Copy link
Copy Markdown
Contributor

Vite folds every plugin's config result into the config the next plugin sees, so the entry input this plugin returns is unioned with an input the app's own plugins declared for the same environment. A framework that names its own server entry — Foldkit's ssr.build, for one — left two entry chunks in the bundle, and the deployed Worker became whichever one the bundle listed first: the framework's server entry rather than the module main names. That Worker exports no handler, and nothing warned.

Rewrite the entry environment's input from the per-environment options hook, which runs after config resolution, where nothing merges over it. Only when main is set, and only for the entry environment — children keep the entries their framework gave them.

…try input

Vite folds every plugin's `config` result into the config the next plugin
sees, so the entry input this plugin returns is unioned with an input the
app's own plugins declared for the same environment. A framework that names
its own server entry — Foldkit's `ssr.build`, for one — left two entry chunks
in the bundle, and the deployed Worker became whichever one the bundle listed
first: the framework's server entry rather than the module `main` names. That
Worker exports no handler, and nothing warned.

Rewrite the entry environment's input from the per-environment `options`
hook, which runs after config resolution, where nothing merges over it. Only
when `main` is set, and only for the entry environment — children keep the
entries their framework gave them.
@sam-goodwin

Copy link
Copy Markdown
Contributor

It's not clear to me what problem this solves and why a blanket solution is the correct approach? Can you elaborate?

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.

2 participants