Do not Override `FileNames` options from `vite.config.ts`
JEleniel opened this issue · 1 comments
Describe the problem
I perform all development work in an environment as close to Production as possible. This means that I am frequently hosting the output from Svelte-s build process in something other than the included Vite server. HMR is not an issue for this workflow. What is an issue is that I need the generated filenames to be deterministic in Dev. Normally I would add the following to the vite.config.ts:
build: {
rollupOptions: {
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name][extname]'
}
}
}but SvelteKit insists on overriding it. I understand the security considerations, and our production deployment is built with that portion of the configuration disabled so the names are not deterministic and the security and cache busting features work as expected.
Our CI/CD process performs the entire build, including installing dependencies and packaging, on the build machine. No build tools are permitted (e.g. pnpm) on the production servers. This means that our build process is all accomplished in a single, atomic, deterministic pass. A single compressed (.tar.gz) file is deployed, uncompressed into place, and the startup command called.
While I am currently able to use Svelte by handling every step manually, not being able to configure pnpm dev means that I am unable to hand any of this work off to my team.
Describe the proposed solution
SvelteKit's build process does not override the following Vite configuration:
build: {
rollupOptions: {
output: {
entryFileNames: 'assets/[name].js',
chunkFileNames: 'assets/[name].js',
assetFileNames: 'assets/[name][extname]'
}
}
}Importance
i cannot use svelte without it
this issue would belong in the sveltejs/kit repo, but regardless I'd be curious to understand why you need it to be like that for your setup to work - whether there is a better way, or maybe whether a custom adapter is what you want