Using legacy Babel transpilation
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. 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.
We provide a compatibility package @remotion/babel-loader that you can install into your Remotion project and use the function replaceLoadersWithBabel() to swap out the ESBuild loader with the old Babel one that was in Remotion 1.0
This should not be necessary in general, it is encouraged to report issues regarding the new ESBuild loader.
Example
- npm
- yarn
- pnpm
bashnpm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
bashnpm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
bashpnpm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
bashpnpm i mdx-loader babel-loader @babel/preset-env @babel/preset-react
bashyarn add mdx-loader babel-loader @babel/preset-env @babel/preset-react
bashyarn add mdx-loader babel-loader @babel/preset-env @babel/preset-react
remotion.config.tstsimport {replaceLoadersWithBabel } from "@remotion/babel-loader";Config .Bundling .overrideWebpackConfig ((currentConfiguration ) => {returnreplaceLoadersWithBabel (currentConfiguration );});
remotion.config.tstsimport {replaceLoadersWithBabel } from "@remotion/babel-loader";Config .Bundling .overrideWebpackConfig ((currentConfiguration ) => {returnreplaceLoadersWithBabel (currentConfiguration );});
When using bundle or deploySite
When using the Node.JS APIs - bundle() for SSR or deploySite() for Lambda, you also need to provide the Webpack override, since the Node.JS APIs do not read from the config file.
my-script.jstsimport {bundle } from "@remotion/bundler";import {replaceLoadersWithBabel } from "@remotion/babel-loader";awaitbundle ({entryPoint :require .resolve ("./src/index.ts"),webpackOverride : (config ) =>replaceLoadersWithBabel (config ),});
my-script.jstsimport {bundle } from "@remotion/bundler";import {replaceLoadersWithBabel } from "@remotion/babel-loader";awaitbundle ({entryPoint :require .resolve ("./src/index.ts"),webpackOverride : (config ) =>replaceLoadersWithBabel (config ),});