-
Notifications
You must be signed in to change notification settings - Fork 57
Fix SSR resolve.external being unconditionally applied in Vite 6+ #236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
🦋 Changeset detectedLatest commit: 5620f91 The changes in this PR will be included in the next version bump. 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 |
Co-authored-by: birkskyum <74932975+birkskyum@users.noreply.github.com>
- Move SSR config from config hook to configEnvironment hook for Vite 6+ - Only set resolve.external if noExternal !== true to avoid conflicts - Maintain backward compatibility with Vite 3, 4, 5 Co-authored-by: birkskyum <74932975+birkskyum@users.noreply.github.com>
commit: |
birkskyum
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested with the the cloudflare vite plugin
TanStack/router#5567
|
The solid-start test suite (main branch, with vinxi) pass as well |
Problem
The
resolve.externalsetting for thessrenvironment was being unconditionally set in theconfighook, which caused conflicts with plugins like@cloudflare/vite-pluginthat setnoExternal: true. This resulted in the following error:Related issue: TanStack/router#5291
Solution
This PR fixes the issue by:
Moving SSR configuration to
configEnvironmenthook (Vite 6+): TheconfigEnvironmenthook runs after theconfighook, allowing other plugins to setnoExternal: truefirst in theirconfighooks.Respecting
noExternal: true: Only setsresolve.externalifconfig.resolve.noExternal !== true, preventing conflicts with plugins that require all dependencies to be bundled.Maintaining backward compatibility: For Vite 3, 4, and 5, the original behavior is preserved by continuing to set
ssr: solidPkgsConfig.ssrin theconfighook.Changes
solidPkgsConfigto closure scope to make it accessible in theconfigEnvironmenthookresolve.noExternalandresolve.externalin theconfigEnvironmenthook only whennoExternal !== trueThis ensures compatibility with Cloudflare and other plugins that require full control over the
noExternalsetting, while maintaining all existing functionality for other use cases.Warning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
download.cypress.ionode index.js --exec install(dns block)If you need me to access, download, or install something from one of these locations, you can either:
Original prompt
Fixes #232
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.