fix: Add cache-busting headers for static files
This commit is contained in:
@@ -40,7 +40,7 @@ const nextConfig = {
|
||||
},
|
||||
],
|
||||
},
|
||||
webpack: (config) => {
|
||||
webpack: (config, { isServer }) => {
|
||||
config.resolve.alias = {
|
||||
...config.resolve.alias,
|
||||
'class-transformer/types/storage': resolve(
|
||||
@@ -48,6 +48,11 @@ const nextConfig = {
|
||||
'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;
|
||||
},
|
||||
async headers() {
|
||||
@@ -61,6 +66,15 @@ const nextConfig = {
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
source: '/_next/static/:path*',
|
||||
headers: [
|
||||
{
|
||||
key: 'Cache-Control',
|
||||
value: 'no-cache, no-store, must-revalidate',
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
},
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user