Skip to content

SSR resolve.external is unconditionally applied #232

Description

@schiller-manuel

right now, the resolve.external setting for the ssr environment is currently unconditionally set here

https://github.com/solidjs/vite-plugin-solid/blob/904b25b6b846a20549281e576947cf5fbb5d55ba/src/index.ts#L280

when used with e.g. the cloudflare vite plugin, this can cause the issue reported here:

TanStack/router#5291

error when starting dev server:
Error: The following environment options are incompatible with the Cloudflare Vite plugin:
        - "ssr" environment: `resolve.external`: ["@solid-primitives/refs","tiny-invariant","@tanstack/history","@solid-devtools/logger","@tanstack/router-core","tiny-warning","isbot","@tanstack/store"]
To resolve this issue, avoid setting `resolve.external` in your Cloudflare Worker environments.

To resolve this, resolve.external should not be set for the ssr environment if noExternal === true.
For this to work, setting this config must be moved to the configEnvironment hook so that another plugin can set noExternal: true in the config hook which runs prior to the configEnvironment hook.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions