Skip to content

Do not Override FileNames options from vite.config.ts #17065

@JEleniel

Description

@JEleniel

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions