Skip to content

🎥 Make videos programmatically with React

Replace more ESM bundling with Bun

Jonny Burger747d07f89d15
diff --git a/packages/animation-utils/bundle.ts b/packages/animation-utils/bundle.ts
new file mode 100644
index 0000000000..b6fef6a414
--- /dev/null
+++ b/packages/animation-utils/bundle.ts
@@ -0,0 +1,14 @@
+import {build} from 'bun';
+
+const output = await build({
+ entrypoints: ['src/index.ts'],
+ naming: '[name].mjs',
+ external: ['react', 'remotion', 'remotion/no-react', 'react/jsx-runtime'],
+});
+
+const [file] = output.outputs;
+const text = await file.text();
+
+await Bun.write('dist/esm/index.mjs', text);
+
+export {};
diff --git a/packages/animation-utils/package.json b/packages/animation-utils/package.json
index 65a03c1b40..251159be26 100644
--- a/packages/animation-utils/package.json
+++ b/packages/animation-utils/package.json
@@ -13,7 +13,7 @@
"formatting": "prettier src --check",
"lint": "eslint src --ext ts,tsx",
"watch": "tsc -w",
- "build": "tsc -d && rollup --config rollup.config.js",
+ "build": "tsc -d && bun bundle.ts",
"test": "vitest --run"
},
"dependencies": {
@@ -35,8 +35,7 @@
"prettier-plugin-organize-imports": "3.2.4",
"eslint": "8.56.0",
"@jonny/eslint-config": "3.0.281",
- "vitest": "0.31.1",
- "rollup": "^2.70.1"
+ "vitest": "0.31.1"
},
"exports": {
"./package.json": "./package.json",
diff --git a/packages/animation-utils/rollup.config.js b/packages/animation-utils/rollup.config.js
deleted file mode 100644
index 692baa92e3..0000000000
--- a/packages/animation-utils/rollup.config.js
+++ /dev/null
@@ -1,23 +0,0 @@
-// rollup.config.js
-import typescript from '@rollup/plugin-typescript';
-
-export default [
- {
- input: 'src/index.ts',
- output: [
- {
- file: 'dist/esm/index.mjs',
- format: 'es',
- sourcemap: false,
- },
- ],
- external: ['react', 'remotion', 'remotion/no-react', 'react/jsx-runtime'],
- plugins: [
- typescript({
- tsconfig: 'tsconfig-esm.json',
- sourceMap: false,
- outputToFilesystem: true,
- }),
- ],
- },
-];
diff --git a/packages/animation-utils/tsconfig-esm.json b/packages/animation-utils/tsconfig-esm.json
deleted file mode 100644
index 38c57cd749..0000000000
--- a/packages/animation-utils/tsconfig-esm.json
+++ /dev/null
@@ -1,11 +0,0 @@
-{
- "extends": "../tsconfig-esm.settings.json",
- "compilerOptions": {
- "rootDir": "./src",
- "outDir": "./dist/esm",
- "skipLibCheck": true,
- "jsx": "react-jsx",
- "moduleResolution": "node"
- },
- "include": ["./src"]
-}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 5e10405ef0..a251eebdca 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -67,9 +67,6 @@ importers:
prettier-plugin-organize-imports:
specifier: 3.2.4
- rollup:
- specifier: ^2.70.1
- version: 2.76.0
vitest:
specifier: 0.31.1