From e73222e6b52092d73f1d46881096fe1697d73fab Mon Sep 17 00:00:00 2001 From: lolcabanon <90099349+lolcabanon@users.noreply.github.com> Date: Fri, 16 Feb 2024 00:19:52 +0100 Subject: [PATCH] Update index.md - Added specific configuration example for Svelte/Kit (#1429) Co-authored-by: pilcrow --- docs/pages/getting-started/sveltekit.md | 13 +++++++++++-- docs/pages/upgrade-v3/index.md | 12 ++++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/docs/pages/getting-started/sveltekit.md b/docs/pages/getting-started/sveltekit.md index 7d9f5b3b8..61db85d7b 100644 --- a/docs/pages/getting-started/sveltekit.md +++ b/docs/pages/getting-started/sveltekit.md @@ -6,12 +6,21 @@ title: "Getting started in Sveltekit" ## Installation -Install Lucia using your package manager of your choice. While not strictly necessary, we recommend installing [Oslo](https://oslo.js.org), which Lucia is built on, for various auth utilities (which a lot of the guides use). +Install Lucia using your package manager of your choice. ``` -npm install lucia oslo +npm install -D lucia ``` +While not strictly necessary, we recommend installing [Oslo](https://oslo.js.org), which Lucia is built on, for various auth utilities (which a lot of the guides use). + +If you use `@sveltejs/adapter-node`, make sure to install `oslo` as a `dependency`, not as `devDependency` to prevent Rollup from bundling `oslo`. See the [SvelteKit documentation](https://kit.svelte.dev/docs/adapter-node#deploying) for details. + +``` +npm install oslo +``` + + ## Initialize Lucia Import `Lucia` and initialize it with your adapter. Refer to the [Database](/database) page to learn how to set up your database and initialize the adapter. Make sure to configure the `sessionCookie` option and register your `Lucia` instance type diff --git a/docs/pages/upgrade-v3/index.md b/docs/pages/upgrade-v3/index.md index dca0b70af..08a91369a 100644 --- a/docs/pages/upgrade-v3/index.md +++ b/docs/pages/upgrade-v3/index.md @@ -209,3 +209,15 @@ const nextConfig = { } }; ``` + +### SvelteKit + +#### @sveltejs/adapter-node + +Make sure to install `oslo` as a `dependency`, not as `devDependency` to prevent `@sveltejs/adapter-node` from bundling `oslo`. + +As per SvelteKit documentation : + +>Development dependencies will be bundled into your app using Rollup. To control whether a given package is bundled or externalised, place it in devDependencies or dependencies respectively in your package.json. + +See [SvelteKit documentation](https://kit.svelte.dev/docs/adapter-node#deploying) for details.