-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Open
Labels
Description
Describe the problem
Background
We have a Node.js project where the /static directory is over 1GB in size.
In production, this directory is served using NGINX.
It does not have to be included in the SvelteKit build.
We keep the copy of the files in /static purely for the development server.
Problem
Current version does not respect the user provided build.copyPublicDir config.
// vite.config.ts
import { sveltekit } from '@sveltejs/kit/vite';
import { defineConfig } from 'vite';
export default defineConfig({
build: { copyPublicDir: false }, // This has no impact.
plugins: [sveltekit()]
});Workaround
// svelte.config.js
import adapter from '@sveltejs/adapter-auto';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
import { randomUUID } from 'node:crypto';
import { env } from 'node:process';
/** @type {import('@sveltejs/kit').Config} */
const config = {
preprocess: vitePreprocess(),
kit: {
adapter: adapter(),
files: { assets: env.NODE_ENV === 'development' ? 'static' : randomUUID() }
}
};
export default config;Describe the proposed solution
Respect build.copyPublicDir, similar to the following PR:
Alternatives considered
- Show warning that the
build.copyPublicDiroption has been overridden. - Provide this as an option for the Node.js adapter.
Importance
would make my life easier
Additional Information
No response