Svelte · Middle · Question 44 of 75
How do you make a module server-only in SvelteKit?
- ✓Correct answer: Add
.serverto the filename (db.server.js) or put it in aserverdirectory; importing it from client code fails the build - 2Add
"use server"at the top - 3Put it in
static/
Explanation
This prevents secrets and database clients from ending up in the browser bundle, even through indirect imports.