cli: fix missing trailing / in public path output config

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2022-06-03 10:52:00 +02:00
parent 621eb6ffd7
commit 026cfe525a
2 changed files with 8 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/cli': patch
---
Fix the public path configuration of the frontend app build so that a trailing `/` is always appended when needed.
+3 -2
View File
@@ -89,6 +89,7 @@ export async function createConfig(
const baseUrl = frontendConfig.getString('app.baseUrl');
const validBaseUrl = new URL(baseUrl);
const publicPath = validBaseUrl.pathname.replace(/\/$/, '');
if (checksEnabled) {
plugins.push(
new ForkTsCheckerWebpackPlugin({
@@ -121,7 +122,7 @@ export async function createConfig(
new HtmlWebpackPlugin({
template: paths.targetHtml,
templateParameters: {
publicPath: validBaseUrl.pathname.replace(/\/$/, ''),
publicPath,
config: frontendConfig,
},
}),
@@ -194,7 +195,7 @@ export async function createConfig(
},
output: {
path: paths.targetDist,
publicPath: validBaseUrl.pathname,
publicPath: `${publicPath}/`,
filename: isDev ? '[name].js' : 'static/[name].[fullhash:8].js',
chunkFilename: isDev
? '[name].chunk.js'