🎥 Make videos programmatically with React
@remotion/bundler: Add plugin to suppress PackFileCacheStrategy warnings
copilot-swe-agent[bot]1734acdc2bcf
diff --git a/packages/bundler/src/ignore-packfilecache-warnings.ts b/packages/bundler/src/ignore-packfilecache-warnings.tsnew file mode 100644index 0000000000..10c85660ca--- /dev/null+++ b/packages/bundler/src/ignore-packfilecache-warnings.ts@@ -0,0 +1,32 @@+// Suppress the frequent Webpack warnings about serializing large strings in the cache++import type {Compiler} from 'webpack';++export class IgnorePackFileCacheWarningsPlugin {+ filter(error: Error) {+ if (+ error.message.includes(+ '[webpack.cache.PackFileCacheStrategy] Serializing big strings',+ )+ ) {+ return false;+ }++ return true;+ }++ apply(compiler: Compiler) {+ compiler.hooks.afterCompile.tap(+ 'IgnorePackFileCacheWarningsPlugin',+ (compilation) => {+ compilation.warnings = compilation.warnings.filter(this.filter);+ },+ );+ compiler.hooks.afterEmit.tap(+ 'IgnorePackFileCacheWarningsPlugin',+ (compilation) => {+ compilation.warnings = compilation.warnings.filter(this.filter);+ },+ );+ }+}diff --git a/packages/bundler/src/test/ignore-packfilecache-warnings.test.ts b/packages/bundler/src/test/ignore-packfilecache-warnings.test.tsnew file mode 100644index 0000000000..6d8b8f78b7--- /dev/null+++ b/packages/bundler/src/test/ignore-packfilecache-warnings.test.ts@@ -0,0 +1,22 @@+import {expect, test} from 'bun:test';+import {IgnorePackFileCacheWarningsPlugin} from '../ignore-packfilecache-warnings';++test('IgnorePackFileCacheWarningsPlugin should filter PackFileCacheStrategy warnings', () => {+ const plugin = new IgnorePackFileCacheWarningsPlugin();++ // Should filter out the target warning+ const targetWarning = new Error(+ '[webpack.cache.PackFileCacheStrategy] Serializing big strings (917kiB) impacts deserialization performance (consider using Buffer instead and decode when needed)'+ );+ expect(plugin.filter(targetWarning)).toBe(false);++ // Should allow other warnings through+ const otherWarning = new Error('Some other webpack warning');+ expect(plugin.filter(otherWarning)).toBe(true);++ // Should allow warnings with similar but not exact text+ const similarWarning = new Error(+ '[webpack.cache.SomeOtherStrategy] Serializing big strings'+ );+ expect(plugin.filter(similarWarning)).toBe(true);+});\ No newline at end of filediff --git a/packages/bundler/src/webpack-config.ts b/packages/bundler/src/webpack-config.tsindex 2b5d47e808..360e4016a4 100644--- a/packages/bundler/src/webpack-config.ts+++ b/packages/bundler/src/webpack-config.ts@@ -8,6 +8,7 @@ import {CaseSensitivePathsPlugin} from './case-sensitive-paths';import type {LoaderOptions} from './esbuild-loader/interfaces';import {ReactFreshWebpackPlugin} from './fast-refresh';import {AllowDependencyExpressionPlugin} from './hide-expression-dependency';+import {IgnorePackFileCacheWarningsPlugin} from './ignore-packfilecache-warnings';import {AllowOptionalDependenciesPlugin} from './optional-dependencies';import {jsonStringifyWithCircularReferences} from './stringify-with-circular-references';import {getWebpackCacheName} from './webpack-cache';@@ -127,6 +128,7 @@ export const webpackConfig = async ({define,new AllowOptionalDependenciesPlugin(),new AllowDependencyExpressionPlugin(),+ new IgnorePackFileCacheWarningsPlugin(),]: [new ProgressPlugin((p) => {@@ -140,6 +142,7 @@ export const webpackConfig = async ({define,new AllowOptionalDependenciesPlugin(),new AllowDependencyExpressionPlugin(),+ new IgnorePackFileCacheWarningsPlugin(),],output: {hashFunction: 'xxhash64',