fix: Add cache-busting headers for static files

This commit is contained in:
Eric F
2026-06-16 07:39:07 -04:00
parent f11a57d318
commit 43b8c3e008

View File

@@ -40,7 +40,7 @@ const nextConfig = {
}, },
], ],
}, },
webpack: (config) => { webpack: (config, { isServer }) => {
config.resolve.alias = { config.resolve.alias = {
...config.resolve.alias, ...config.resolve.alias,
'class-transformer/types/storage': resolve( 'class-transformer/types/storage': resolve(
@@ -48,6 +48,11 @@ const nextConfig = {
'node_modules/class-transformer/cjs/storage.js', 'node_modules/class-transformer/cjs/storage.js',
), ),
}; };
// Force new file names to bust cache
if (!isServer) {
config.output.filename = 'static/chunks/[name].[contenthash:8].js';
config.output.chunkFilename = 'static/chunks/[name].[contenthash:8].js';
}
return config; return config;
}, },
async headers() { async headers() {
@@ -61,6 +66,15 @@ const nextConfig = {
}, },
], ],
}, },
{
source: '/_next/static/:path*',
headers: [
{
key: 'Cache-Control',
value: 'no-cache, no-store, must-revalidate',
},
],
},
]; ];
}, },
}; };