Skip to content

🎥 Make videos programmatically with React

`@remotion/bundler`: Fix rspack HMR breakage from whisper-web circular chunk dependency

Jonny Burger3ba2eee49e9e
diff --git a/packages/bundler/src/rspack-config.ts b/packages/bundler/src/rspack-config.ts
index a1133a2b0f..d6dcb3bec9 100644
--- a/packages/bundler/src/rspack-config.ts
+++ b/packages/bundler/src/rspack-config.ts
@@ -94,7 +94,6 @@ export const rspackConfig = async ({
// but the TypeScript types differ. Cast through `any` for the override.
const conf = (await webpackOverride({
...getBaseConfig(environment, poll),
- ignoreWarnings: [/"__dirname" is used and has been mocked/],
node: {
// Suppress the warning in `source-map`
__dirname: 'mock',
@@ -129,6 +128,18 @@ export const rspackConfig = async ({
module: {
rules: [
...getSharedModuleRules(),
+ {
+ // Emscripten's main.js spawns Workers of itself via
+ // new Worker(new URL('./main.js', import.meta.url)).
+ // This creates a circular chunk dependency that breaks HMR when `@remotion/whisper-web` is used.
+ // TODO: whisper-web does not work in Studio with Rspack, also not with Webpack.
+ // Disable Worker detection so rspack doesn't create a
+ // worker chunk; the new URL() is still handled as an asset.
+ test: /[\\/]whisper-web[\\/]main\.js$/,
+ parser: {
+ worker: false,
+ },
+ },
{
test: /\.tsx?$/,
use: [swcLoaderRule],