Breaking Changes
Previously the vite.config.ts
config was responsible for building both the client build files (the ones running in the browser) and the SSR build files (the one executed from the server, like node/express, cloudflare, etc). Moving forward we're going to use adaptor configs that extend the base vite config, then adds its own SSR/SSG capabilities. If you're upgrading from a qwik-city 0.0.117 or less, it's best to add the adaptor you'll be using with qwik add
.
First, update to the latest version of @builder.io/qwik
and @builder.io/qwik-city
.
Next, run npm run qwik add
, then select the adaptor you'd like to add, such as Adaptor: Express (server)
.
The CLI will add the adaptors
directory, and update the build.server
script in package.json
. You'll notice there's now another vite config in the adaptors
directory, which is what's called by the build.server
script.
Next, in the root vite.config.ts
config, make sure there isn't an ssr
config. For example:
export default defineConfig(() => {
return {
- ssr: {
- target: 'node',
- format: 'cjs',
- },
plugins: [
qwikCity(),
qwikVite()
]
};
});
Updating a Static Site Generated (SSG) config
If your package.json
was previously using a build.static
and ssg
scripts, they can now be removed since it's now apart of the SSG adaptor.
"scripts": {
"build": "qwik build",
"build.client": "vite build",
"build.preview": "vite build --ssr src/entry.preview.tsx",
"build.server": "vite build -c adaptors/static/vite.config.ts",
- "build.static": "vite build --ssr src/entry.static.tsx",
- "ssg": "node server/entry.static",
"build.types": "tsc --incremental --noEmit",
"dev": "vite --mode ssr",
"preview": "qwik build preview && vite preview --open",
"start": "vite --open --mode ssr",
"qwik": "qwik"
},
You can also now delete the src/entry.static.tsx
file, it's no longer needed and any SSG config is now in the adaptors/static/vite.config.ts
config.
What's Changed
New Contributors
Full Changelog: https://github.com/BuilderIO/qwik/compare/v0.11.1...v0.12.0