Skip to content

🎥 Make videos programmatically with React

webpackoverridefn

Jonny Burger08af62f9b82f
diff --git a/packages/bundler/src/bundle.ts b/packages/bundler/src/bundle.ts
index 584cd5af80..1d33b95791 100644
--- a/packages/bundler/src/bundle.ts
+++ b/packages/bundler/src/bundle.ts
@@ -1,13 +1,13 @@
import fs, {promises} from 'fs';
import os from 'os';
import path from 'path';
-import type {WebpackOverrideFn} from 'remotion';
import {promisify} from 'util';
import webpack from 'webpack';
import {isMainThread} from 'worker_threads';
import {copyDir} from './copy-dir';
import {indexHtml} from './index-html';
import {readRecursively} from './read-recursively';
+import type {WebpackOverrideFn} from './webpack-config';
import {webpackConfig} from './webpack-config';
const promisified = promisify(webpack);
diff --git a/packages/bundler/src/index.ts b/packages/bundler/src/index.ts
index 582ef46590..5674e27422 100644
--- a/packages/bundler/src/index.ts
+++ b/packages/bundler/src/index.ts
@@ -16,6 +16,6 @@ export const BundlerInternals = {
readRecursively,
};
-export {WebpackConfiguration, WebpackOverrideFn} from 'remotion';
export {bundle, BundleOptions, LegacyBundleOptions} from './bundle';
+export {WebpackConfiguration, WebpackOverrideFn} from './webpack-config';
export {webpack};
diff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.ts
index 260736e6a7..9a0a44cbc7 100644
--- a/packages/bundler/src/webpack-config.ts
+++ b/packages/bundler/src/webpack-config.ts
@@ -1,6 +1,5 @@
import {createHash} from 'crypto';
import ReactDOM from 'react-dom';
-import type {WebpackConfiguration, WebpackOverrideFn} from 'remotion';
import {Internals} from 'remotion';
import webpack, {ProgressPlugin} from 'webpack';
import type {LoaderOptions} from './esbuild-loader/interfaces';
@@ -9,6 +8,13 @@ import {jsonStringifyWithCircularReferences} from './stringify-with-circular-ref
import {getWebpackCacheName} from './webpack-cache';
import esbuild = require('esbuild');
+import type {Configuration} from 'webpack';
+export type WebpackConfiguration = Configuration;
+
+export type WebpackOverrideFn = (
+ currentConfiguration: WebpackConfiguration
+) => WebpackConfiguration;
+
if (!ReactDOM || !ReactDOM.version) {
throw new Error('Could not find "react-dom" package. Did you install it?');
}
diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.ts
index ba83fec513..0b47ef9f51 100644
--- a/packages/cli/src/config/index.ts
+++ b/packages/cli/src/config/index.ts
@@ -129,6 +129,7 @@ declare global {
* You can set an absolute path or a relative path that will be resolved from the closest package.json location.
*/
readonly setPublicDir: (publicDir: string | null) => void;
+ readonly overrideWebpackConfig: (f: WebpackOverrideFn) => void;
}
// Legacy config format: New options to not need to be added here.
interface RemotionConfigObject {
diff --git a/packages/compositor-darwin-arm64/compositor b/packages/compositor-darwin-arm64/compositor
index cff233f9b1..bd0e5d37a1 100755
Binary files a/packages/compositor-darwin-arm64/compositor and b/packages/compositor-darwin-arm64/compositor differ