Calling bundle() in bundled code
If you receive the following error:
⨯ ./node_modules/@remotion/bundler/node_modules/webpack/lib/FileSystemInfo.js:9:0Module not found: Can't resolve 'module'Did you mean './module'?Requests that should resolve in the current directory need to start with './'.
⨯ ./node_modules/@remotion/bundler/node_modules/webpack/lib/FileSystemInfo.js:9:0Module not found: Can't resolve 'module'Did you mean './module'?Requests that should resolve in the current directory need to start with './'.
or
⨯ ./node_modules/@remotion/compositor-darwin-arm64/remotionModule parse failed: Unexpected character '�' (1:0)You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
⨯ ./node_modules/@remotion/compositor-darwin-arm64/remotionModule parse failed: Unexpected character '�' (1:0)You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
it means that the bundle()
function is being bundled itself for example by Webpack or ESBuild.
This occurs for example if bundle()
or deploySite()
is being called in a Next.js serverless function.
To bundle the bundle()
function, Webpack needs specific configuration, which is missing.
However, we don't recommend that you call bundle()
at runtime at all.
What you actually want
Most likely, you don't want to bundle your video at runtime, but rather at build time.
You only need to re-bundle the video if you change the source code of it. However, this should not be necessary at runtime, as you can parametrize everything without changing the source code.
See how to parametrize the content with input props as well as the metadata of your video.
Recipes
If you are using a long-running server: we recommend to call bundle()
once in a Node.js context and then reusing it for the lifetime of the server. See: Rendering in Node.js
If you are rendering on Lambda: Create a bundle and deploy it once either via npx remotion sites create
or using deploySite()
in a non-bundled Node.js script and then refer to the bundle via the URL that you get back.
In both cases, do all parameterization of the video using input props.