Skip to content

🎥 Make videos programmatically with React

finish updating the docs

Jonny Burgercb2cb98e1bbf
diff --git a/packages/docs/docs/legacy-babel-loader.md b/packages/docs/docs/legacy-babel-loader.md
index 00931b3dd5..5c469e5fe4 100644
--- a/packages/docs/docs/legacy-babel-loader.md
+++ b/packages/docs/docs/legacy-babel-loader.md
@@ -3,6 +3,8 @@ title: Using legacy Babel transpilation
id: legacy-babel
---
+import Tabs from "@theme/Tabs";
+
In Remotion 2.0, the traditional transpilation of Javascript and Typescript using the `babel-loader` has been replaced by the faster `esbuild-loader` by default.
If you for some reason need to go back to the previous behavior, you may [override the Webpack configuration](/docs/webpack). Remember that overriding the Webpack configuration works reducer-style, where you get the default configuration in a function argument and you return the modified version of your config.
@@ -13,10 +15,38 @@ This should not be necessary in general, it is encouraged to [report issues](htt
## Example
-```bash title="Console"
-npm i @remotion/babel-loader
+<Tabs
+defaultValue="npm"
+values={[
+{ label: 'npm', value: 'npm', },
+{ label: 'yarn', value: 'yarn', },
+{ label: 'pnpm', value: 'pnpm', },
+]
+}>
+<TabItem value="npm">
+
+```bash
+npm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
+```
+
+ </TabItem>
+ <TabItem value="pnpm">
+
+```bash
+pnpm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
+```
+
+ </TabItem>
+
+ <TabItem value="yarn">
+
+```bash
+yarn add mdx-loader babel-loader @babel/preset-env @babel/preset-react
```
+ </TabItem>
+</Tabs>
+
```ts twoslash title="remotion.config.ts"
import { Config } from "remotion";
// ---cut---
@@ -27,6 +57,25 @@ Config.Bundling.overrideWebpackConfig((currentConfiguration) => {
});
```
+## When using `bundle` or `deploySite`
+
+When using the Node.JS APIs - [`bundle()`](/docs/bundle) for SSR or [`deploySite()`](/docs/lambda/deploysite) for Lambda, you also need to provide the Webpack override, since the Node.JS APIs do not read from the config file.
+
+```ts twoslash title="my-script.js"
+// @filename: ./src/webpack-override.ts
+import { WebpackOverrideFn } from "remotion";
+export const webpackOverride: WebpackOverrideFn = (c) => c;
+// @filename: remotion.config.ts
+// @target: esnext
+// ---cut---
+import { bundle } from "@remotion/bundler";
+import { replaceLoadersWithBabel } from "@remotion/babel-loader";
+
+await bundle(require.resolve("./src/index.ts"), () => undefined, {
+ webpackOverride: (config) => replaceLoadersWithBabel(config),
+});
+```
+
## See also
- [Custom Webpack config](/docs/webpack)
diff --git a/packages/docs/docs/overwriting-webpack-config.md b/packages/docs/docs/overwriting-webpack-config.md
index 2fc144da85..3cde7bec4a 100644
--- a/packages/docs/docs/overwriting-webpack-config.md
+++ b/packages/docs/docs/overwriting-webpack-config.md
@@ -244,15 +244,15 @@ const enableSass: WebpackOverrideFn = (currentConfiguration) => {
3. Add the override function to your [`remotion.config.ts`](/docs/config) file:
```ts twoslash title="remotion.config.ts"
-// @filename: ./src/enable-mdx.ts
+// @filename: ./src/enable-sass.ts
import { WebpackOverrideFn } from "remotion";
-export const enableMdx: WebpackOverrideFn = (c) => c;
+export const enableSass: WebpackOverrideFn = (c) => c;
// @filename: remotion.config.ts
// ---cut---
import { Config } from "remotion";
-import { enableMdx } from "./src/enable-mdx";
+import { enableSass } from "./src/enable-sass";
-Config.Bundling.overrideWebpackConfig(enableMdx);
+Config.Bundling.overrideWebpackConfig(enableSass);
```
4. Add it to your [Node.JS API calls as well if necessary](#when-using-bundle-and-deploysite).
@@ -295,12 +295,12 @@ pnpm i glsl-shader-loader glslify glslify-import-loader raw-roader
</TabItem>
</Tabs>
-2. Add the following to your [`remotion.config.ts`](/docs/config) file:
+2. Declare a webpack override:
-```ts twoslash
-import { Config } from "remotion";
-// ---cut---
-Config.Bundling.overrideWebpackConfig((currentConfiguration) => {
+```ts twoslash title="src/enable.glsl.ts"
+import { WebpackOverrideFn } from "remotion";
+
+export const enableGlsl: WebpackOverrideFn = (currentConfiguration) => {
return {
...currentConfiguration,
module: {
@@ -317,7 +317,20 @@ Config.Bundling.overrideWebpackConfig((currentConfiguration) => {
],
},
};
-});
+};
+```
+
+```ts twoslash title="remotion.config.ts"
+// @filename: ./src/enable-glsl.ts
+import { WebpackOverrideFn } from "remotion";
+export const enableGlsl: WebpackOverrideFn = (c) => c;
+
+// @filename: remotion.config.ts
+// ---cut---
+import { Config } from "remotion";
+import { enableGlsl } from "./src/enable-glsl";
+
+Config.Bundling.overrideWebpackConfig(enableGlsl);
```
3. Add the following to your entry file (e.g. `src/index.tsx`):
@@ -329,8 +342,10 @@ declare module "*.glsl" {
}
```
-4. Reset the webpack cache by deleting the `node_modules/.cache` folder.
-5. Restart the preview server.
+4. Add it to your [Node.JS API calls as well if necessary](#when-using-bundle-and-deploysite).
+
+5. Reset the webpack cache by deleting the `node_modules/.cache` folder.
+6. Restart the preview server.
### Enable WebAssembly
@@ -374,6 +389,8 @@ rm -rf node_modules/.cache
After restarting, you can import `.wasm` files using an import statement.
+Add the Webpack override to your [Node.JS API calls as well if necessary](#when-using-bundle-and-deploysite).
+
### Use legacy babel loader
See [Using legacy Babel transpilation](/docs/legacy-babel).