remotion-dev/remotion · error

The Browser Studio bootstrap must not bundle Transformers.js

Error message

The Browser Studio bootstrap must not bundle Transformers.js. Keep it in the lazy Transformers entry.

What it means

After building the Browser Studio bootstrap, the script scans bundle outputs for forbidden strings ('onnxruntime-web' or 'transformers.web.js'). If any file other than the dedicated lazy transformers entry references them, it means Transformers.js was accidentally bundled into the main bootstrap. This is a deliberate architecture guard to keep the bootstrap small and load the heavy ML runtime lazily.

Source

Thrown at packages/browser-studio/bundle.ts:110

if (!output.success) {
	console.log(output.logs.join('\n'));
	process.exit(1);
}

const externalVersionSensitiveImport =
	/^[^'"\n]*\bfrom\s*["']@remotion\/(?:player|studio-shared|timeline-utils)["'];?\s*$|^\s*import\s*["']@remotion\/(?:player|studio-shared|timeline-utils)["'];?\s*$/m;

for (const file of [
	...output.outputs,
	...vendorOutput.outputs,
	...transformersOutput.outputs,
]) {
	const str = await file.text();
	if (
		!file.path.includes('browser-studio-transformers-entry') &&
		(str.includes('onnxruntime-web') || str.includes('transformers.web.js'))
	) {
		throw new Error(
			'The Browser Studio bootstrap must not bundle Transformers.js. Keep it in the lazy Transformers entry.',
		);
	}

	if (
		path.basename(file.path) === 'browser-studio-vendor-entry.mjs' &&
		externalVersionSensitiveImport.test(str)
	) {
		throw new Error(
			'Browser Studio must bundle version-sensitive workspace packages into its vendor entry so it cannot link against an incompatible published version.',
		);
	}

	const out = path.join('dist', 'esm', file.path);

	await Bun.write(out, str);
}

View on GitHub (pinned to b2f4e34732)

Solutions

  1. Move any Transformers.js / onnxruntime-web imports into src/browser-studio-transformers-entry.ts so they stay in the lazy entry
  2. Check the bootstrap import graph (e.g. with a bundler analyzer) and break the dependency that pulls transformers into the main chunk
  3. Use dynamic import() for transformers functionality in bootstrap code
  4. If the transformers entry file was renamed, update the file.path.includes('browser-studio-transformers-entry') exclusion

Example fix

// before
import {transformers} from 'onnxruntime-web';
export const runTransformers = () => transformers();
// after
export const runTransformers = async () => {
	const mod = await import('./browser-studio-transformers-entry');
	return mod.runTransformers();
};
Defensive patterns

Strategy: validation

Validate before calling

// pre-commit check that the bootstrap has no transformers references:
const offender = outputs.find((f) =>
	!f.path.includes('browser-studio-transformers-entry') &&
	(f.text().includes('onnxruntime-web') || f.text().includes('transformers.web.js')));
if (offender) throw new Error(offender.path);

Prevention

When it happens

Trigger: Adding an import of @remotion/browser-studio transformers code, onnxruntime-web, or Transformers.js to a module reachable from the bootstrap entrypoint; moving transformers-dependent code out of browser-studio-transformers-entry.ts; changing the exclusion check file name so the transformers entry itself is no longer skipped.

Common situations: Refactoring imports so transformers utilities get pulled into the main chunk; adding a dependency that statically imports onnxruntime-web; renaming browser-studio-transformers-entry.ts without updating the guard.

Understand the failure class

Background: "This is a bug, please report it": internal invariant violations, unreachable panics, and SNH errors explained — this error's family across 47 libraries.

Related errors


AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09). Data as JSON: /api/errors/b5a283f94e799788. Report an issue: GitHub.