ddev-sveltekit Svelte Themes

Ddev Sveltekit

Run sveltekit with vite in dev mode behind nginx ssl proxy.

ddev-sveltekit

Run sveltekit with vite in dev mode behind nginx ssl proxy.

This is for @sveltejs/kit <= 1.0.0-next.525.

https://github.com/torenware/ddev-viteserve might fit your needs better if you are not using svelte.

Note: This will not install if there is already a src/hooks.server.[jt]s file.

You should review your src/hooks.server.[jt]s file and either remove it or you'd have to adjust all your files manually.

This exposes the debug port of vite on the container port 9229 aswell. To use it, run

ddev viteinspect instead of ddev yarn dev.

What does it do?

  1. Overwrite .ddev/nginx_full/nginx-site.conf to proxy requests to http://localhost:5173 and pass the adjusted origin.
  2. Install a src/hooks.server.js to adjust the origin to DDEV_PRIMARY_URL on outgoing cors requests when using svelte's provided fetch.
  3. Add this src/hooks.server.js to .git/info/exclude.
  4. Install a .ddev/docker-compose.network.yaml to add additional known hosts in the network.
  5. Install a .ddev/docker-compose.debug.yaml to expose the vite debugging port

Sample Usage:

ddev config --auto --omit-containers=db,dba --nodejs-version=16 
mkcert -install
ddev get mdc-git/ddev-sveltekit
ddev viteinspect

Other resources:

Debugging notes:

Top categories

Loading Svelte Themes