cli: use correct public path for /auth entry point bundles
Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
@@ -66,7 +66,12 @@ export async function buildBundle(options: BuildOptions) {
|
||||
dist: 'dist/auth',
|
||||
});
|
||||
if (authPaths) {
|
||||
configs.push(await createConfig(authPaths, commonConfigOptions));
|
||||
configs.push(
|
||||
await createConfig(authPaths, {
|
||||
...commonConfigOptions,
|
||||
publicSubPath: '/auth',
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
const isCi = yn(process.env.CI, { default: false });
|
||||
|
||||
@@ -92,7 +92,7 @@ export async function createConfig(
|
||||
paths: BundlingPaths,
|
||||
options: BundlingOptions,
|
||||
): Promise<webpack.Configuration> {
|
||||
const { checksEnabled, isDev, frontendConfig } = options;
|
||||
const { checksEnabled, isDev, frontendConfig, publicSubPath = '' } = options;
|
||||
|
||||
const { plugins, loaders } = transforms(options);
|
||||
// Any package that is part of the monorepo but outside the monorepo root dir need
|
||||
@@ -102,7 +102,11 @@ export async function createConfig(
|
||||
|
||||
const baseUrl = frontendConfig.getString('app.baseUrl');
|
||||
const validBaseUrl = new URL(baseUrl);
|
||||
const publicPath = validBaseUrl.pathname.replace(/\/$/, '');
|
||||
let publicPath = validBaseUrl.pathname.replace(/\/$/, '');
|
||||
if (publicSubPath) {
|
||||
publicPath = `${publicPath}${publicSubPath}`.replace('//', '/');
|
||||
}
|
||||
|
||||
if (checksEnabled) {
|
||||
plugins.push(
|
||||
new ForkTsCheckerWebpackPlugin({
|
||||
|
||||
@@ -208,7 +208,13 @@ DEPRECATION WARNING: React Router Beta is deprecated and support for it will be
|
||||
dist: 'dist/auth',
|
||||
});
|
||||
const compiler = authPaths
|
||||
? webpack([config, await createConfig(authPaths, commonConfigOptions)])
|
||||
? webpack([
|
||||
config,
|
||||
await createConfig(authPaths, {
|
||||
...commonConfigOptions,
|
||||
publicSubPath: '/auth',
|
||||
}),
|
||||
])
|
||||
: webpack(config);
|
||||
|
||||
webpackServer = new WebpackDevServer(
|
||||
|
||||
@@ -26,6 +26,8 @@ export type BundlingOptions = {
|
||||
baseUrl: URL;
|
||||
parallelism?: number;
|
||||
additionalEntryPoints?: string[];
|
||||
// Path to append to the detected public path, e.g. '/auth'
|
||||
publicSubPath?: string;
|
||||
};
|
||||
|
||||
export type ServeOptions = BundlingPathsOptions & {
|
||||
|
||||
Reference in New Issue
Block a user