From 987f45179b3164539195a180f4112a461a32619c Mon Sep 17 00:00:00 2001 From: BaiJunjie Date: Fri, 20 Sep 2024 15:41:00 +0900 Subject: [PATCH] fix: The `remoteEntryChunk` should use the base path from the Vite config. Fixes #629 --- packages/lib/src/prod/expose-production.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/lib/src/prod/expose-production.ts b/packages/lib/src/prod/expose-production.ts index 8a9f6c38..f92ff0e3 100644 --- a/packages/lib/src/prod/expose-production.ts +++ b/packages/lib/src/prod/expose-production.ts @@ -13,7 +13,7 @@ // SPDX-License-Identifier: MulanPSL-2.0 // ***************************************************************************** -import { resolve, parse, basename, extname, relative, dirname } from 'path' +import { resolve, parse, basename, extname, relative, dirname, join } from 'path' import { getModuleMarker, normalizePath, @@ -239,7 +239,7 @@ export function prodExposePlugin( const slashPath = fileRelativePath.replace(/\\/g, '/') remoteEntryChunk.code = remoteEntryChunk.code.replace( `\${__federation_expose_${expose[0]}}`, - `./${slashPath}` + join(viteConfigResolved.config?.base, viteConfigResolved.config?.build.assetsDir, slashPath) ) } }