Merge pull request #31145 from Bogdan-Lyashenko/bohdanl/webpack-config-fix

Use contenthash name param for webpack caching
This commit is contained in:
Patrik Oldsberg
2025-09-15 12:49:44 +02:00
committed by GitHub
3 changed files with 8 additions and 3 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Updated the WebPack configuration to use `contenthash`. This fixes an issue were builds would sometimes generate output files with the same name but different content across builds, leading to breakages when loading the frontend app.
@@ -430,10 +430,10 @@ export async function createConfig(
path: paths.targetDist,
publicPath:
options.moduleFederation?.mode === 'remote' ? 'auto' : `${publicPath}/`,
filename: isDev ? '[name].js' : 'static/[name].[fullhash:8].js',
filename: isDev ? '[name].js' : 'static/[name].[contenthash:8].js',
chunkFilename: isDev
? '[name].chunk.js'
: 'static/[name].[chunkhash:8].chunk.js',
: 'static/[name].[contenthash:8].chunk.js',
...(isDev
? {
devtoolModuleFilenameTemplate: (info: any) =>
@@ -72,7 +72,7 @@ export const optimization = (
},
filename: isDev
? 'module-[name].js'
: 'static/module-[name].[chunkhash:8].js',
: 'static/module-[name].[contenthash:8].js',
priority: 10,
minSize: 100000,
minChunks: 1,