Skip to content

🎥 Make videos programmatically with React

import transitions ESM correctly in node

Jonny Burgerc756f4e58db4
diff --git a/packages/it-tests/package.json b/packages/it-tests/package.json
index 38a90c58ec..a7ce27148b 100644
--- a/packages/it-tests/package.json
+++ b/packages/it-tests/package.json
@@ -13,7 +13,18 @@
"@remotion/cli": "workspace:*",
"@remotion/lambda": "workspace:*",
"@remotion/cloudrun": "workspace:*",
+ "@remotion/player": "workspace:*",
+ "@remotion/preload": "workspace:*",
"@remotion/renderer": "workspace:*",
+ "@remotion/shapes": "workspace:*",
+ "@remotion/zod-types": "workspace:*",
+ "@remotion/noise": "workspace:*",
+ "@remotion/motion-blur": "workspace:*",
+ "@remotion/media-utils": "workspace:*",
+ "@remotion/lottie": "workspace:*",
+ "@remotion/layout-utils": "workspace:*",
+ "@remotion/google-fonts": "workspace:*",
+ "@remotion/transitions": "workspace:*",
"@types/sharp": "^0.28.5",
"create-video": "workspace:*",
"execa": "5.1.1",
diff --git a/packages/it-tests/src/monorepo/esm.test.ts b/packages/it-tests/src/monorepo/esm.test.ts
new file mode 100644
index 0000000000..7e517b4288
--- /dev/null
+++ b/packages/it-tests/src/monorepo/esm.test.ts
@@ -0,0 +1,47 @@
+import { execSync } from "child_process";
+import { expect, test } from "vitest";
+
+test('Should be able to "import" frontend in node', async () => {
+ execSync(
+ `node --input-type=module -e "import {TransitionSeries} from '@remotion/transitions'; console.log(TransitionSeries)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {Player} from '@remotion/player'; console.log(Player)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {preloadAudio} from '@remotion/preload'; console.log(preloadAudio)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {Rect} from '@remotion/shapes'; console.log(Rect)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {zColor} from '@remotion/zod-types'; console.log(zColor)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {noise2D} from '@remotion/noise'; console.log(noise2D)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {CameraMotionBlur} from '@remotion/motion-blur'; console.log(CameraMotionBlur)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {getVideoMetadata} from '@remotion/media-utils'; console.log(getVideoMetadata)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {Lottie} from '@remotion/lottie'; console.log(Lottie)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {measureText} from '@remotion/layout-utils'; console.log(measureText)"`
+ );
+ execSync(
+ `node --input-type=module -e "import {loadFont} from '@remotion/google-fonts/Montserrat'; console.log(loadFont)"`
+ );
+
+ expect(() =>
+ execSync(
+ `node --input-type=module -e "import {Misspell} from '@remotion/shapes'; console.log(Rect)"`,
+ {
+ stdio: "ignore",
+ }
+ )
+ ).toThrow();
+});
diff --git a/packages/transitions/package.json b/packages/transitions/package.json
index 12b20c8951..033804a8fa 100644
--- a/packages/transitions/package.json
+++ b/packages/transitions/package.json
@@ -6,6 +6,7 @@
"main": "dist/cjs/index.js",
"module": "dist/index.js",
"types": "dist/index.d.ts",
+ "type": "module",
"scripts": {
"lint": "eslint src --ext ts,tsx",
"formatting": "prettier src --check",
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 3c8ddf6c55..ede832ef00 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1040,12 +1040,45 @@ importers:
'@remotion/cloudrun':
specifier: workspace:*
version: link:../cloudrun
+ '@remotion/google-fonts':
+ specifier: workspace:*
+ version: link:../google-fonts
'@remotion/lambda':
specifier: workspace:*
version: link:../lambda
+ '@remotion/layout-utils':
+ specifier: workspace:*
+ version: link:../layout-utils
+ '@remotion/lottie':
+ specifier: workspace:*
+ version: link:../lottie
+ '@remotion/media-utils':
+ specifier: workspace:*
+ version: link:../media-utils
+ '@remotion/motion-blur':
+ specifier: workspace:*
+ version: link:../motion-blur
+ '@remotion/noise':
+ specifier: workspace:*
+ version: link:../noise
+ '@remotion/player':
+ specifier: workspace:*
+ version: link:../player
+ '@remotion/preload':
+ specifier: workspace:*
+ version: link:../preload
'@remotion/renderer':
specifier: workspace:*
version: link:../renderer
+ '@remotion/shapes':
+ specifier: workspace:*
+ version: link:../shapes
+ '@remotion/transitions':
+ specifier: workspace:*
+ version: link:../transitions
+ '@remotion/zod-types':
+ specifier: workspace:*
+ version: link:../zod-types
'@types/sharp':
specifier: ^0.28.5
version: 0.28.6