Skip to content

🎥 Make videos programmatically with React

Fix React duplicate key warnings when bundling

Jonny Burger4ebdecd212b7
diff --git a/packages/animation-utils/bundle.ts b/packages/animation-utils/bundle.ts
index edfe05b71e..0b69f3484f 100644
--- a/packages/animation-utils/bundle.ts
+++ b/packages/animation-utils/bundle.ts
@@ -1,4 +1,16 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
diff --git a/packages/animation-utils/package.json b/packages/animation-utils/package.json
index 1740212d81..1f46b99c3a 100644
--- a/packages/animation-utils/package.json
+++ b/packages/animation-utils/package.json
@@ -12,7 +12,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts",
+ "build": "NODE_ENV=production bun bundle.ts",
"test": "vitest --run"
},
"dependencies": {
diff --git a/packages/astro-example/build.mjs b/packages/astro-example/build.mjs
index 68e81e1427..7d7ce6f885 100644
--- a/packages/astro-example/build.mjs
+++ b/packages/astro-example/build.mjs
@@ -15,6 +15,6 @@ if (majorVersion < 16) {
process.exit(0);
}
-execSync("bunx astro build", {
+execSync("bun x astro build", {
stdio: "inherit",
});
diff --git a/packages/cli-autocomplete/src/generate.ts b/packages/cli-autocomplete/src/generate.ts
index 924900d6fd..2bb17ddb0f 100644
--- a/packages/cli-autocomplete/src/generate.ts
+++ b/packages/cli-autocomplete/src/generate.ts
@@ -8,7 +8,7 @@ const output = `const completionSpec: Fig.Spec = ${stringified}; export default
writeFileSync("src/generatedCompletionSpec.ts", output);
-execSync("bunx prettier --write src/generatedCompletionSpec.ts");
-execSync("bunx eslint --fix src/generatedCompletionSpec.ts", {
+execSync("bun x prettier --write src/generatedCompletionSpec.ts");
+execSync("bun x eslint --fix src/generatedCompletionSpec.ts", {
stdio: "inherit",
});
diff --git a/packages/cloudrun/build.ts b/packages/cloudrun/build.ts
index 54a9d3b6af..a05b0620a3 100644
--- a/packages/cloudrun/build.ts
+++ b/packages/cloudrun/build.ts
@@ -1,6 +1,6 @@
import {$} from 'bun';
-await $`bunx tsc -d`;
+await $`bun x tsc -d`;
const permissions = Bun.file('src/shared/sa-permissions.json');
await Bun.write('dist/shared/sa-permissions.json', permissions);
diff --git a/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar b/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar
index 3a25b51386..8d24fa64f8 100644
Binary files a/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar and b/packages/cloudrun/src/gcpInstaller/gcpInstaller.tar differ
diff --git a/packages/compositor-darwin-arm64/remotion b/packages/compositor-darwin-arm64/remotion
index 4bfa29f583..9b4f15027b 100755
Binary files a/packages/compositor-darwin-arm64/remotion and b/packages/compositor-darwin-arm64/remotion differ
diff --git a/packages/core/bundle.ts b/packages/core/bundle.ts
index ace31297ba..27fcfe7cc8 100644
--- a/packages/core/bundle.ts
+++ b/packages/core/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
@@ -8,10 +21,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
-
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
const versionOutput = await build({
diff --git a/packages/core/ensure-correct-version.ts b/packages/core/ensure-correct-version.ts
index 836dc9390c..ac88b49d37 100644
--- a/packages/core/ensure-correct-version.ts
+++ b/packages/core/ensure-correct-version.ts
@@ -19,7 +19,7 @@ export const VERSION = '${version}';
fs.writeFileSync(path.resolve(process.cwd(), 'src/version.ts'), src);
cp.execSync('pnpm build');
-cp.execSync('bunx tsc -d');
+cp.execSync('bun x tsc -d');
const distFile = fs.readFileSync('dist/esm/version.mjs', 'utf-8');
diff --git a/packages/core/package.json b/packages/core/package.json
index 2d852591df..3a00f7b904 100644
--- a/packages/core/package.json
+++ b/packages/core/package.json
@@ -10,7 +10,7 @@
"prepublishOnly": "bun ensure-correct-version.ts && cp ../../README.md .",
"lint": "eslint src --ext ts,tsx",
"test": "vitest --run",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"repository": {
"url": "https://github.com/remotion-dev/remotion"
@@ -37,8 +37,8 @@
"jsdom": "21.1.0",
"prettier": "3.2.5",
"prettier-plugin-organize-imports": "3.2.4",
- "react": "18.3.1",
- "react-dom": "18.3.1",
+ "react": "18.2.0",
+ "react-dom": "18.2.0",
"rimraf": "^3.0.2",
"vitest": "0.31.1",
"webpack": "5.83.1",
diff --git a/packages/core/src/test/interpolate.test.ts b/packages/core/src/test/interpolate.test.ts
index 32e776d03d..da54ef0b4d 100644
--- a/packages/core/src/test/interpolate.test.ts
+++ b/packages/core/src/test/interpolate.test.ts
@@ -213,3 +213,7 @@ test('wrap option', () => {
expect(interpolate(1.5, [0, 1], [0, 2], {extrapolateRight: 'wrap'})).toBe(1);
expect(interpolate(-0.5, [0, 1], [0, 2], {extrapolateLeft: 'wrap'})).toBe(1);
});
+
+test('4 and 5', () => {
+ interpolate(1, [0, 1, 4, 9], [0, 2, 1000, -1000, 5]);
+});
diff --git a/packages/docs/render-cards.mjs b/packages/docs/render-cards.mjs
index 9a44e3edca..81c3a08376 100644
--- a/packages/docs/render-cards.mjs
+++ b/packages/docs/render-cards.mjs
@@ -78,7 +78,7 @@ fs.writeFileSync(
`export const articles = ` + JSON.stringify(data, null, 2),
);
-execSync("bunx prettier src/data/articles.ts --write");
+execSync("bun x prettier src/data/articles.ts --write");
// render cards
const serveUrl = await bundle({
diff --git a/packages/gif/build.mjs b/packages/gif/build.mjs
index 11e02d5bb4..fa2e137ab9 100644
--- a/packages/gif/build.mjs
+++ b/packages/gif/build.mjs
@@ -25,6 +25,6 @@ export const src =
`.trim(),
);
-execSync('bunx prettier --write src/worker/source.ts');
+execSync('bun x prettier --write src/worker/source.ts');
fs.unlinkSync(tmp);
diff --git a/packages/gif/bundle.ts b/packages/gif/bundle.ts
index 01cc8307e7..5b4ef3ff6f 100644
--- a/packages/gif/bundle.ts
+++ b/packages/gif/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
@@ -8,10 +21,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
-
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
export {};
diff --git a/packages/gif/package.json b/packages/gif/package.json
index f7775baed9..f6eb5573d3 100644
--- a/packages/gif/package.json
+++ b/packages/gif/package.json
@@ -17,7 +17,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "node build.mjs && bun bundle.ts"
+ "build": "node build.mjs && NODE_ENV=production bun bundle.ts"
},
"exports": {
"./package.json": "./package.json",
diff --git a/packages/google-fonts/bundle.ts b/packages/google-fonts/bundle.ts
index 7de3952827..b5ffa17f20 100644
--- a/packages/google-fonts/bundle.ts
+++ b/packages/google-fonts/bundle.ts
@@ -1,4 +1,18 @@
-import { build } from "bun";
+import { build, revision } from "bun";
+
+if (process.env.NODE_ENV !== "production") {
+ throw new Error("This script must be run using NODE_ENV=production");
+}
+
+if (!revision.startsWith("07ce")) {
+ // eslint-disable-next-line no-console
+ console.warn("warn: Remotion currently uses a fork of Bun to bundle.");
+ // eslint-disable-next-line no-console
+ console.log(
+ "You dont currently run the fork, this could lead to duplicate key warnings in React."
+ );
+}
+
import path from "path";
import { filteredFonts } from "./scripts/filtered-fonts";
import { removeWhitespace } from "./scripts/utils";
@@ -20,10 +34,7 @@ const output = await build({
for (const file of output.outputs) {
const str = await file.text();
- const newStr = str
- .replace(/jsxDEV/g, "jsx")
- .replace(/react\/jsx-dev-runtime/g, "react/jsx-runtime")
- .replace(/import\(\"(.*)\"\)/g, 'import("$1.mjs")');
+ const newStr = str.replace(/import\(\"(.*)\"\)/g, 'import("$1.mjs")');
if (newStr.includes(`import("./ABeeZee")`)) {
throw new Error("not compiled correctly");
diff --git a/packages/google-fonts/package.json b/packages/google-fonts/package.json
index e9f49db77f..a3e9b27cc1 100644
--- a/packages/google-fonts/package.json
+++ b/packages/google-fonts/package.json
@@ -5,7 +5,7 @@
"main": "dist/cjs/index.js",
"module": "dist/esm/index.mjs",
"scripts": {
- "build": "bun bundle.ts",
+ "build": "NODE_ENV=production bun bundle.ts",
"generate": "bun scripts/generate.ts && bun scripts/generate-index.ts",
"prepublishOnly": "bun ensure-generation.ts"
},
diff --git a/packages/layout-utils/package.json b/packages/layout-utils/package.json
index 36552338b7..1de7ba9bf2 100644
--- a/packages/layout-utils/package.json
+++ b/packages/layout-utils/package.json
@@ -9,7 +9,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"exports": {
"./package.json": "./package.json",
diff --git a/packages/lottie/bundle.ts b/packages/lottie/bundle.ts
index 1f56e9584a..3670138438 100644
--- a/packages/lottie/bundle.ts
+++ b/packages/lottie/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
@@ -13,9 +26,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/lottie/package.json b/packages/lottie/package.json
index df2883e1c1..fae621b20f 100644
--- a/packages/lottie/package.json
+++ b/packages/lottie/package.json
@@ -10,7 +10,7 @@
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
"test": "bun test src",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"repository": {
"url": "https://github.com/remotion-dev/remotion"
diff --git a/packages/motion-blur/bundle.ts b/packages/motion-blur/bundle.ts
index edfe05b71e..b6fef6a414 100644
--- a/packages/motion-blur/bundle.ts
+++ b/packages/motion-blur/bundle.ts
@@ -7,9 +7,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/motion-blur/package.json b/packages/motion-blur/package.json
index 6abeba2094..bfef24fbe8 100644
--- a/packages/motion-blur/package.json
+++ b/packages/motion-blur/package.json
@@ -9,7 +9,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"author": "Matt McGillivray, Ilija Boshkov <[email protected]>, Jonny Burger <[email protected]>",
"contributors": [],
diff --git a/packages/noise/bundle.ts b/packages/noise/bundle.ts
index dc587bea1d..4b5612d613 100644
--- a/packages/noise/bundle.ts
+++ b/packages/noise/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
@@ -7,9 +20,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/noise/package.json b/packages/noise/package.json
index 6f24956e76..cd47759e72 100644
--- a/packages/noise/package.json
+++ b/packages/noise/package.json
@@ -9,7 +9,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts",
+ "build": "NODE_ENV=production bun bundle.ts",
"test": "vitest --run"
},
"exports": {
diff --git a/packages/player-example/package.json b/packages/player-example/package.json
index 836ea86b08..1ec947ebd2 100644
--- a/packages/player-example/package.json
+++ b/packages/player-example/package.json
@@ -18,8 +18,8 @@
"@types/react-dom": "18.3.0",
"eslint": "8.56.0",
"next": "14.1.4",
- "react": "18.3.1",
- "react-dom": "18.3.1",
+ "react": "18.2.0",
+ "react-dom": "18.2.0",
"remotion": "workspace:*"
},
"devDependencies": {
diff --git a/packages/player/bundle.ts b/packages/player/bundle.ts
index c854cfee00..197318bc6f 100644
--- a/packages/player/bundle.ts
+++ b/packages/player/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
@@ -8,9 +21,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', `"use client";\n${text}`);
diff --git a/packages/player/package.json b/packages/player/package.json
index ed2458133c..35369de055 100644
--- a/packages/player/package.json
+++ b/packages/player/package.json
@@ -9,7 +9,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun ensure-correct-version.ts && bun bundle.ts",
+ "build": "bun ensure-correct-version.ts && NODE_ENV=production bun bundle.ts",
"test": "vitest src --run",
"prerelease": "cp ../../README.md ."
},
@@ -54,8 +54,8 @@
"jsdom": "20.0.1",
"prettier": "3.2.5",
"prettier-plugin-organize-imports": "3.2.4",
- "react": "18.3.1",
- "react-dom": "18.3.1",
+ "react": "18.2.0",
+ "react-dom": "18.2.0",
"vitest": "0.31.1",
"webpack": "5.83.1",
"zod": "3.22.3"
diff --git a/packages/rive/bundle.ts b/packages/rive/bundle.ts
index e11d6328c8..f6d486489c 100644
--- a/packages/rive/bundle.ts
+++ b/packages/rive/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
@@ -13,9 +26,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/rive/package.json b/packages/rive/package.json
index 048ca87526..842828c56f 100644
--- a/packages/rive/package.json
+++ b/packages/rive/package.json
@@ -8,7 +8,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"repository": {
"url": "https://github.com/remotion-dev/remotion"
diff --git a/packages/skia/bundle.ts b/packages/skia/bundle.ts
index 58e1f2077b..6afd14d9f3 100644
--- a/packages/skia/bundle.ts
+++ b/packages/skia/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const mainModule = await build({
entrypoints: ['src/index.ts'],
@@ -13,9 +26,7 @@ const mainModule = await build({
});
const [file] = mainModule.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/skia/package.json b/packages/skia/package.json
index b92c22bcca..0415c50f36 100644
--- a/packages/skia/package.json
+++ b/packages/skia/package.json
@@ -9,7 +9,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"author": "Jonny Burger <[email protected]>, William Candillon <[email protected]>",
"contributors": [],
diff --git a/packages/studio/bundle.ts b/packages/studio/bundle.ts
index 047c382ffe..19998be4d3 100644
--- a/packages/studio/bundle.ts
+++ b/packages/studio/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const mainModule = await build({
entrypoints: ['src/index.ts'],
@@ -7,9 +20,7 @@ const mainModule = await build({
});
const [file] = mainModule.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/studio/package.json b/packages/studio/package.json
index 68ca9e7fbe..b9334005f8 100644
--- a/packages/studio/package.json
+++ b/packages/studio/package.json
@@ -6,7 +6,7 @@
"sideEffects": false,
"scripts": {
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts",
+ "build": "NODE_ENV=production bun bundle.ts",
"test": "bun test src",
"formatting": "prettier src --check"
},
diff --git a/packages/tailwind/bundle.ts b/packages/tailwind/bundle.ts
index 62640e7872..180d29b368 100644
--- a/packages/tailwind/bundle.ts
+++ b/packages/tailwind/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/enable.ts'],
@@ -69,9 +82,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/tailwind/package.json b/packages/tailwind/package.json
index 80b2eb3a08..2c1ca584b3 100644
--- a/packages/tailwind/package.json
+++ b/packages/tailwind/package.json
@@ -8,7 +8,7 @@
"sideEffects": false,
"scripts": {
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"author": "Jonny Burger <[email protected]>",
"contributors": [],
diff --git a/packages/three/bundle.ts b/packages/three/bundle.ts
index c7bdc0c08c..4b8ea74119 100644
--- a/packages/three/bundle.ts
+++ b/packages/three/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
@@ -16,9 +29,7 @@ const output = await build({
});
const [file] = output.outputs;
-const text = (await file.text())
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+const text = await file.text();
await Bun.write('dist/esm/index.mjs', text);
diff --git a/packages/three/package.json b/packages/three/package.json
index 9b13e90393..186edcf081 100644
--- a/packages/three/package.json
+++ b/packages/three/package.json
@@ -9,7 +9,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"author": "Björn Zeutzheim",
"contributors": [],
diff --git a/packages/transitions/bundle.ts b/packages/transitions/bundle.ts
index dc944f5cb7..cd8bf4934e 100644
--- a/packages/transitions/bundle.ts
+++ b/packages/transitions/bundle.ts
@@ -1,7 +1,21 @@
-const presentations = ['slide', 'flip', 'wipe', 'fade', 'clock-wipe'];
-import {build} from 'bun';
+import {build, revision} from 'bun';
import path from 'path';
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
+
+const presentations = ['slide', 'flip', 'wipe', 'fade', 'clock-wipe'];
+
const output = await build({
entrypoints: [
'src/index.ts',
@@ -22,9 +36,7 @@ const output = await build({
for (const file of output.outputs) {
const str = await file.text();
- const newStr = str
- .replace(/jsxDEV/g, 'jsx')
- .replace(/react\/jsx-dev-runtime/g, 'react/jsx-runtime');
+ const newStr = str;
Bun.write(path.join('dist', 'esm', file.path), newStr);
}
diff --git a/packages/transitions/package.json b/packages/transitions/package.json
index bdb39b4ba4..415e41bacb 100644
--- a/packages/transitions/package.json
+++ b/packages/transitions/package.json
@@ -10,7 +10,7 @@
"test": "vitest src --run",
"lint": "eslint src --ext ts,tsx",
"formatting": "prettier src --check",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"author": "Jonny Burger",
"contributors": [],
diff --git a/packages/zod-types/bundle.ts b/packages/zod-types/bundle.ts
index e4a3d27761..67e8a9588b 100644
--- a/packages/zod-types/bundle.ts
+++ b/packages/zod-types/bundle.ts
@@ -1,4 +1,17 @@
-import {build} from 'bun';
+import {build, revision} from 'bun';
+
+if (process.env.NODE_ENV !== 'production') {
+ throw new Error('This script must be run using NODE_ENV=production');
+}
+
+if (!revision.startsWith('07ce')) {
+ // eslint-disable-next-line no-console
+ console.warn('warn: Remotion currently uses a fork of Bun to bundle.');
+ // eslint-disable-next-line no-console
+ console.log(
+ 'You dont currently run the fork, this could lead to duplicate key warnings in React.',
+ );
+}
const output = await build({
entrypoints: ['src/index.ts'],
diff --git a/packages/zod-types/package.json b/packages/zod-types/package.json
index 7621f0492b..12b9f2153f 100644
--- a/packages/zod-types/package.json
+++ b/packages/zod-types/package.json
@@ -9,7 +9,7 @@
"scripts": {
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
- "build": "bun bundle.ts"
+ "build": "NODE_ENV=production bun bundle.ts"
},
"author": "Jonny Burger",
"contributors": [],
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 60b81dd323..d6717e95b7 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -468,7 +468,7 @@ importers:
'@testing-library/react':
specifier: 14.0.0
'@types/node':
specifier: 18.14.6
version: 18.14.6
@@ -497,11 +497,11 @@ importers:
specifier: 3.2.4
react:
- specifier: 18.3.1
- version: 18.3.1
+ specifier: 18.2.0
+ version: 18.2.0
react-dom:
- specifier: 18.3.1
- version: 18.3.1([email protected])
+ specifier: 18.2.0
+ version: 18.2.0([email protected])
rimraf:
specifier: ^3.0.2
version: 3.0.2
@@ -1536,7 +1536,7 @@ importers:
'@testing-library/react':
specifier: 13.1.1
'@types/node':
specifier: 18.14.6
version: 18.14.6
@@ -1565,11 +1565,11 @@ importers:
specifier: 3.2.4
react:
- specifier: 18.3.1
- version: 18.3.1
+ specifier: 18.2.0
+ version: 18.2.0
react-dom:
- specifier: 18.3.1
- version: 18.3.1([email protected])
+ specifier: 18.2.0
+ version: 18.2.0([email protected])
vitest:
specifier: 0.31.1
version: 0.31.1([email protected])
@@ -1611,13 +1611,13 @@ importers:
version: 8.56.0
next:
specifier: 14.1.4
react:
- specifier: 18.3.1
- version: 18.3.1
+ specifier: 18.2.0
+ version: 18.2.0
react-dom:
- specifier: 18.3.1
- version: 18.3.1([email protected])
+ specifier: 18.2.0
+ version: 18.2.0([email protected])
remotion:
specifier: workspace:*
version: link:../core
@@ -9454,7 +9454,7 @@ packages:
pretty-format: 27.5.1
dev: true
resolution: {integrity: sha512-8mirlAa0OKaUvnqnZF6MdAh2tReYA2KtWVw1PKvaF5EcCZqgK5pl8iF+3uW90JdG5Ua2c2c2E2wtLdaug3dsVg==}
engines: {node: '>=12'}
peerDependencies:
@@ -9464,8 +9464,8 @@ packages:
'@babel/runtime': 7.17.9
'@testing-library/dom': 8.16.0
'@types/react-dom': 18.3.0
- react: 18.3.1
- react-dom: 18.3.1([email protected])
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
dev: true
@@ -9496,7 +9496,7 @@ packages:
react-dom: 18.3.1([email protected])
dev: true
resolution: {integrity: sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==}
engines: {node: '>=14'}
peerDependencies:
@@ -9506,8 +9506,8 @@ packages:
'@babel/runtime': 7.19.0
'@testing-library/dom': 9.0.0
'@types/react-dom': 18.3.0
- react: 18.3.1
- react-dom: 18.3.1([email protected])
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
dev: true
/@tootallnate/[email protected]:
@@ -17668,7 +17668,7 @@ packages:
resolution: {integrity: sha512-mc/caHeUcdjnC/boPWJefDr4KUIWQNv+tlnFnJd38QMou86QtxQzBJfxgGRzvx8jazYRqrVlaHarfO72uNxPOg==}
dev: false
resolution: {integrity: sha512-1WTaXeSrUwlz/XcnhGTY7+8eiaFvdet5z9u3V2jb+Ek1vFo0VhHKSAIJvDWfQpttWjnyw14kBeq28TPq7bTeEQ==}
engines: {node: '>=18.17.0'}
hasBin: true
@@ -17689,9 +17689,9 @@ packages:
caniuse-lite: 1.0.30001577
graceful-fs: 4.2.11
postcss: 8.4.31
- react: 18.3.1
- react-dom: 18.3.1([email protected])
- styled-jsx: 5.1.1([email protected])
+ react: 18.2.0
+ react-dom: 18.2.0([email protected])
+ styled-jsx: 5.1.1([email protected])
optionalDependencies:
'@next/swc-darwin-arm64': 14.1.4
'@next/swc-darwin-x64': 14.1.4
@@ -19693,8 +19693,7 @@ packages:
dependencies:
loose-envify: 1.4.0
react: 18.2.0
- scheduler: 0.23.0
- dev: false
+ scheduler: 0.23.2
resolution: {integrity: sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==}
@@ -19883,7 +19882,6 @@ packages:
engines: {node: '>=0.10.0'}
dependencies:
loose-envify: 1.4.0
- dev: false
resolution: {integrity: sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==}
@@ -20522,12 +20520,6 @@ packages:
dependencies:
loose-envify: 1.4.0
- resolution: {integrity: sha512-CtuThmgHNg7zIZWAXi3AsyIzA3n4xx7aNyjwC2VJldO2LMVDhFK+63xGqq6CsJH4rTAt6/M+N4GhZiDYPx9eUw==}
- dependencies:
- loose-envify: 1.4.0
- dev: false
-
resolution: {integrity: sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==}
dependencies:
@@ -21382,7 +21374,7 @@ packages:
supports-color: 5.5.0
dev: false
resolution: {integrity: sha512-pW7uC1l4mBZ8ugbiZrcIsiIvVx1UmTfw7UkC3Um2tmfUq9Bhk8IiyEIPl6F8agHgjzku6j0xQEZbfA5uSgSaCw==}
engines: {node: '>= 12.0.0'}
peerDependencies:
@@ -21396,7 +21388,7 @@ packages:
optional: true
dependencies:
client-only: 0.0.1
- react: 18.3.1
+ react: 18.2.0
dev: false
diff --git a/set-version.mjs b/set-version.mjs
index 241acbe3d4..2097390cec 100644
--- a/set-version.mjs
+++ b/set-version.mjs
@@ -39,7 +39,7 @@ for (const dir of [path.join("cloudrun", "container"), ...dirs]) {
writeFileSync(packageJsonPath, JSON.stringify(packageJson, null, 2) + "\n");
try {
console.log("setting version for", dir);
- execSync("bunx prettier --write package.json", {
+ execSync("bun x prettier --write package.json", {
cwd: path.join(process.cwd(), "packages", dir),
});
} catch (e) {
@@ -51,7 +51,7 @@ execSync("bun ensure-correct-version.ts", {
cwd: "packages/core",
});
-execSync("bunx vitest src/monorepo --run", {
+execSync("bun x vitest src/monorepo --run", {
cwd: "packages/it-tests",
stdio: "inherit",
});