bundling-bundle
如果您收到 以下错误:
⨯ ./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 './'.
或者
⨯ ./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
这意味着bundle()
函数本身正在被打包,例如被Webpack或ESBuild打包。
例如,如果在Next.js无服务器函数中调用了bundle()
或deploySite()
,就会发生这种情况。
要打包bundle()
函数,Webpack需要特定的配置,但目前缺少这些配置。
但是,我们不建议您在运行时调用bundle()
。
您实际想要的是什么
很可能,您不希望在运行时打包视频,而是在构建时打包。
只有在更改视频的源代码时才需要重新打包视频。但是,在运行时这是不必要的,因为您可以在不更改源代码的情况下对所有内容进行参数化。
查看如何使用input props对视频内容进行参数化。
示例
**如果您正在使用长时间运行的服务器:**我们建议在Node.js上下文中调用bundle()
一次,然后在服务器的生命周期内重复使用它。参见:在Node.js中渲染
如果您在Lambda上渲染:创建一个捆绑包并通过npx remotion sites create
或在非捆绑的Node.js脚本中使用deploySite()
部署一次,然后通过获取的URL引用 捆绑包。
在这两种情况下,使用input props对视频进行所有参数化。
另请参阅
I'm ready to translate the Markdown content into Chinese. Please go ahead and paste the content for translation.