sveltejs / sveltejs/kit

Custom output rollup configuration is overhidden by the default configuration

Open
#1,410 10 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

vite
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the bug
In the svelte configuration file when we try to set the assetFileNames or chunkFileNames in output rollup, this is overhidden by the default configuration

To Reproduce
Set a assetFileNames in the rollup options and check the assets files.

Expected behavior
The configuration set in the svelte configuration file must be used.

Information about your SvelteKit Installation:
Next version: 103

Severity
Blocking our usage of SvelteKit: declare static asset files in the micro-frontend application

Additional context
This portion of code seems to be the origin of the issue: https://github.com/sveltejs/kit/blob/57efb032983a614462bae6b1d7496072b6aa8c96/packages/kit/src/core/build/index.js#L149

	rollupOptions: {
		...(user_config.build && user_config.build.rollupOptions),
		input,
		output: {
			entryFileNames: '[name]-[hash].js',
			chunkFileNames: 'chunks/[name]-[hash].js',
			assetFileNames: 'assets/[name]-[hash][extname]'
		},
		preserveEntrySignatures: 'strict'
	}
},

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in packages/kit/src/core/build/index.js at the rollupOptions output configuration linked in the issue. Reproduce the problem by setting assetFileNames or chunkFileNames in the Svelte configuration and checking the generated assets. Done means those user-provided output settings are used instead of being overwritten by the defaults.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, rollup
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.