Skip to content

🎥 Make videos programmatically with React

works with ESM wallaby

Jonny Burger8887e99b6dc9
diff --git a/packages/astro-example/README.md b/packages/astro-example/README.md
index 52cfb908d0..fb5c2d2e98 100644
--- a/packages/astro-example/README.md
+++ b/packages/astro-example/README.md
@@ -1,12 +1,4 @@
-# Astro + React Example
+# Astro Testbed
-```
-npm create astro@latest -- --template framework-react
-```
-
-[![Open in StackBlitz](https://developer.stackblitz.com/img/open_in_stackblitz.svg)](https://stackblitz.com/github/withastro/astro/tree/latest/examples/framework-react)
-[![Open with CodeSandbox](https://assets.codesandbox.io/github/button-edit-lime.svg)](https://codesandbox.io/p/sandbox/github/withastro/astro/tree/latest/examples/framework-react)
-
-This example showcases Astro working with [React](https://reactjs.org/).
-
-Write your React components as `.jsx` or `.tsx` files in your project.
+Checks that Remotion works correctly in Astro and also Vite.
+Also serves as a testbed for ESM, CJS
diff --git a/packages/astro-example/package.json b/packages/astro-example/package.json
index a7f0952a24..8a1b8fef78 100644
--- a/packages/astro-example/package.json
+++ b/packages/astro-example/package.json
@@ -6,7 +6,7 @@
"scripts": {
"dev": "astro dev",
"start": "astro dev",
- "build": "node test.mjs && node test.cjs && node build.mjs",
+ "build": "node test.mjs && node test.cjs && node -r esm-wallaby test.js && node build.mjs",
"preview": "astro preview",
"astro": "astro"
},
@@ -16,6 +16,7 @@
"@types/react": "^18.0.10",
"@types/react-dom": "^18.0.5",
"astro": "^2.0.14",
+ "esm-wallaby": "^3.2.26",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"remotion": "3.3.54"
diff --git a/packages/astro-example/test.cjs b/packages/astro-example/test.cjs
index 18d2ecd54e..30e6754451 100644
--- a/packages/astro-example/test.cjs
+++ b/packages/astro-example/test.cjs
@@ -1,9 +1,12 @@
const assert = require("assert");
const { interpolate } = require("remotion");
const { Player } = require("@remotion/player");
+const { VERSION } = require("remotion/version");
+
const val = interpolate(1, [0, 1], [0, 100]);
assert(val === 100);
assert(Boolean(Player));
+assert(typeof VERSION === "string");
console.log("CommonJS works!");
diff --git a/packages/astro-example/test.js b/packages/astro-example/test.js
new file mode 100644
index 0000000000..5b20f1a548
--- /dev/null
+++ b/packages/astro-example/test.js
@@ -0,0 +1,12 @@
+const assert = require("assert");
+const { interpolate } = require("remotion");
+const { Player } = require("@remotion/player");
+const { VERSION } = require("remotion/version");
+
+const val = interpolate(1, [0, 1], [0, 100]);
+
+assert(val === 100);
+assert(Boolean(Player));
+assert(typeof VERSION === "string");
+
+console.log("ESM Wallaby works!");
diff --git a/packages/astro-example/test.mjs b/packages/astro-example/test.mjs
index 0b82a69328..4f25a2f169 100644
--- a/packages/astro-example/test.mjs
+++ b/packages/astro-example/test.mjs
@@ -1,10 +1,12 @@
import assert from "assert";
import { interpolate } from "remotion";
import { Player } from "@remotion/player";
+import { VERSION } from "remotion/version";
const val = interpolate(1, [0, 1], [0, 100]);
assert(val === 100);
assert(Boolean(Player));
+assert(typeof VERSION === "string");
console.log("ESM works!");
diff --git a/packages/core/version.js b/packages/core/version.js
new file mode 100644
index 0000000000..d069bf9147
--- /dev/null
+++ b/packages/core/version.js
@@ -0,0 +1,2 @@
+// For backwards compatibility when you use `esm-wallaby`
+module.exports = require('./dist/cjs/version');
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 9d5eeca9f0..6adfef2238 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -20,6 +20,7 @@ importers:
'@types/react': ^18.0.10
'@types/react-dom': ^18.0.5
astro: ^2.0.14
+ esm-wallaby: ^3.2.26
react: ^18.1.0
react-dom: ^18.1.0
remotion: 3.3.54
@@ -29,6 +30,7 @@ importers:
'@types/react': 18.0.26
'@types/react-dom': 18.0.10
astro: 2.0.14
+ esm-wallaby: 3.2.26
react: 18.2.0
react-dom: [email protected]
remotion: link:../core
@@ -14250,6 +14252,11 @@ packages:
transitivePeerDependencies:
- supports-color
+ /esm-wallaby/3.2.26:
+ resolution: {integrity: sha512-DtbO0pdJj7kv/abkQ1BjIpk/Rm6vy9ueGcsXuQT7jH6qw6RQby/i/qeVyIcf2pbpAT5UW8PN+dL2YZakTw+URA==}
+ engines: {node: '>=6'}
+ dev: false
+
/espree/9.3.1:
resolution: {integrity: sha512-bvdyLmJMfwkV3NCRl5ZhJf22zBFo1y8bYh3VYb+bfzqNB4Je68P2sSuXyuFquzWLebHpNd2/d5uv7yoP9ISnGQ==}
engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0}