Skip to content

Update the qwikVite plugin to support Vite's environment API #7815

@tylerAtKunai

Description

@tylerAtKunai

From a conversation in Discord:

Areas in the qwikVite plugin we need to start gradually changing to support the environment api:

Lines 103-150:

https://github.com/QwikDev/qwik/blob/build/v2/packages/qwik/src/optimizer/src/plugins/vite.ts#L103

Implicit environment handling. Assumes there will only ever be two environments, SSR and CSR as if it were a boolean

We need to change the logic around this, and probably change the wording of target to environment .

Instead of opts.target -> we want to use this.environment.

The plugin handling will run specifically on a per environment basis.

--

Lines 103 - 335:

Uses old patterns like the deprecated build.ssr config option. Lots of old environment checks.


Lines 222-231

Sets top level ssr config which is old. This should be in the environments object.


Lines 464-566

The manifest generation could likely be refactored given that we no longer have to build things in two separate processes. This means vite plugin pre and post could likely be merged into one vite plugin.

Also the vite plugin makes certain SSR assumptions based on file names, such as entry. or entry_. These should probably refactored / changed to be more flexible and allow those building on top of Qwik to manage entry files how they wish.


Also old code in plugin.ts exists which relies on old environment checks, like getIsServer

Metadata

Metadata

Assignees

Type

No type

Projects

Status

In progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions