Skip to content

always bundle devDependencies #6301

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/selfish-cougars-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'create-svelte': patch
---

Update default Vite config so that devDependencies are always bundled
12 changes: 11 additions & 1 deletion packages/create-svelte/shared/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import fs from 'fs';
import { sveltekit } from '@sveltejs/kit/vite';
import type { UserConfig } from 'vite';

const pkg = JSON.parse(fs.readFileSync('package.json', 'utf-8'));

/** @type {import('vite').UserConfig} */
const config: UserConfig = {
plugins: [sveltekit()]
plugins: [sveltekit()],

ssr: {
// bundle everything in devDependencies, so our
// deployment only needs prod dependencies
external: Object.keys(pkg.dependencies ?? {}),
noExternal: true
}
};

export default config;
2 changes: 1 addition & 1 deletion packages/create-svelte/templates/default/src/lib/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { invalidate } from '$app/navigation';
* response: Response;
* form: HTMLFormElement;
* }) => void;
* }} [opts]
* }} opts
*/
export function enhance(
form: HTMLFormElement,
Expand Down