sveltejs/kit · warning

precompress is ignored with buildOptions.compile: embedded a

Error message

precompress is ignored with buildOptions.compile: embedded assets are imported by identity path

What it means

The Bun adapter can embed server assets via `buildOptions.compile` (bundling them by identity path into the executable), which makes precompression pointless. When both `precompress: true` and `buildOptions.compile` are set, this warning tells you the precompress setting is ignored.

Source

Thrown at packages/adapter-bun/index.js:126

		serverOptions = {},
		buildOptions = {}
	} = opts;

	return {
		name: '@sveltejs/adapter-bun',
		async adapt(builder) {
			if (typeof Bun === 'undefined') {
				throw new Error(
					'adapter-bun requires running the SvelteKit build with Bun. Use `bun run --bun build`.'
				);
			}

			fs.rmSync(out, { recursive: true, force: true });

			builder.log.minor('Building server');

			if (precompress && buildOptions.compile) {
				builder.log.warn(
					'precompress is ignored with buildOptions.compile: embedded assets are imported by identity path'
				);
			}

			const server = builder.getServerDirectory();

			const src_dir = path.resolve(import.meta.dirname, 'src');
			const index_file = path.resolve(src_dir, 'index.js');
			const routes_file = path.resolve(src_dir, 'routes.js');
			const manifest_file = path.resolve(server, 'manifest.js');
			const server_options_file = path.resolve(src_dir, 'options.js');

			const tmp = builder.getBuildDirectory('bun-tmp');
			fs.mkdirSync(tmp, { recursive: true });
			builder.generateServerInstance(`${tmp}/server.js`);

			const virtual_files = {
				[manifest_file]:

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Remove `precompress: true` (it does nothing with compile) or set it to false
  2. If you need precompressed assets, disable `buildOptions.compile` so assets are emitted as files
  3. Ignore the warning if the behavior (no precompress) is acceptable

Example fix

// before
adapter({ precompress: true, buildOptions: { compile: true } })
// after
adapter({ buildOptions: { compile: true } })
Defensive patterns

Strategy: validation

Validate before calling

// validate adapter options before build
function validateBunAdapterOptions(opts) {
  if (opts.precompress && opts.buildOptions?.compile) {
    console.warn('precompress will be ignored because buildOptions.compile is enabled');
  }
}

Prevention

When it happens

Trigger: In svelte.config.js adapter-bun options, setting `precompress: true` together with `buildOptions.compile: true`, then running the adapt/build step.

Common situations: Enabling precompress by habit from other adapters while also enabling Bun's single-file executable compile; migrating config from adapter-node to adapter-bun without pruning options.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/d8d829c2f3ad83be. Report an issue: GitHub.