From 82f84b886bae983f7739861c88e0111eb95b598c Mon Sep 17 00:00:00 2001 From: Aukevanoost Date: Wed, 3 Dec 2025 19:12:10 +0100 Subject: [PATCH 1/2] fix(1006): Support for windows paths --- .../src/lib/core/build-for-federation.ts | 2 +- .../src/lib/core/bundle-shared.ts | 11 +++++++++-- .../src/lib/{core => utils}/bundle-caching.ts | 0 .../src/lib/utils/mapped-paths.ts | 4 ++++ 4 files changed, 14 insertions(+), 3 deletions(-) rename libs/native-federation-core/src/lib/{core => utils}/bundle-caching.ts (100%) diff --git a/libs/native-federation-core/src/lib/core/build-for-federation.ts b/libs/native-federation-core/src/lib/core/build-for-federation.ts index a333b6ef..17a2db4a 100644 --- a/libs/native-federation-core/src/lib/core/build-for-federation.ts +++ b/libs/native-federation-core/src/lib/core/build-for-federation.ts @@ -14,7 +14,7 @@ import { FederationOptions } from './federation-options'; import { writeFederationInfo } from './write-federation-info'; import { writeImportMap } from './write-import-map'; import { logger } from '../utils/logger'; -import { getCachePath } from './bundle-caching'; +import { getCachePath } from './../utils/bundle-caching'; import { normalizePackageName } from '../utils/normalize'; import { AbortedError } from '../utils/errors'; diff --git a/libs/native-federation-core/src/lib/core/bundle-shared.ts b/libs/native-federation-core/src/lib/core/bundle-shared.ts index 19670df4..f1dc0943 100644 --- a/libs/native-federation-core/src/lib/core/bundle-shared.ts +++ b/libs/native-federation-core/src/lib/core/bundle-shared.ts @@ -17,7 +17,12 @@ import { isSourceFile, rewriteChunkImports, } from '../utils/rewrite-chunk-imports'; -import { cacheEntry, getChecksum, getFilename } from './bundle-caching'; +import { + cacheEntry, + getChecksum, + getFilename, +} from './../utils/bundle-caching'; +import { getSeparator } from '../utils/mapped-paths'; export async function bundleShared( sharedBundles: Record, @@ -172,7 +177,9 @@ export async function bundleShared( bundleCache.persist({ checksum, externals: result, - files: bundleResult.map((r) => r.fileName.split('/').pop() ?? r.fileName), + files: bundleResult.map( + (r) => r.fileName.split(getSeparator(r.fileName)).pop() ?? r.fileName, + ), }); bundleCache.copyFiles( diff --git a/libs/native-federation-core/src/lib/core/bundle-caching.ts b/libs/native-federation-core/src/lib/utils/bundle-caching.ts similarity index 100% rename from libs/native-federation-core/src/lib/core/bundle-caching.ts rename to libs/native-federation-core/src/lib/utils/bundle-caching.ts diff --git a/libs/native-federation-core/src/lib/utils/mapped-paths.ts b/libs/native-federation-core/src/lib/utils/mapped-paths.ts index 5a5a4137..ee674496 100644 --- a/libs/native-federation-core/src/lib/utils/mapped-paths.ts +++ b/libs/native-federation-core/src/lib/utils/mapped-paths.ts @@ -13,6 +13,10 @@ export interface GetMappedPathsOptions { rootPath?: string; } +export function getSeparator(path: string) { + return path.includes('\\') ? '\\' : '/'; +} + export function getMappedPaths({ rootTsConfigPath, sharedMappings, From cff08a3e38adad563671b293e192bcb3f5913c2c Mon Sep 17 00:00:00 2001 From: Aukevanoost Date: Thu, 4 Dec 2025 09:28:25 +0100 Subject: [PATCH 2/2] fix: Switch to env separator --- libs/native-federation-core/src/lib/core/bundle-shared.ts | 3 +-- libs/native-federation-core/src/lib/utils/mapped-paths.ts | 4 ---- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/libs/native-federation-core/src/lib/core/bundle-shared.ts b/libs/native-federation-core/src/lib/core/bundle-shared.ts index f1dc0943..3a6bc084 100644 --- a/libs/native-federation-core/src/lib/core/bundle-shared.ts +++ b/libs/native-federation-core/src/lib/core/bundle-shared.ts @@ -22,7 +22,6 @@ import { getChecksum, getFilename, } from './../utils/bundle-caching'; -import { getSeparator } from '../utils/mapped-paths'; export async function bundleShared( sharedBundles: Record, @@ -178,7 +177,7 @@ export async function bundleShared( checksum, externals: result, files: bundleResult.map( - (r) => r.fileName.split(getSeparator(r.fileName)).pop() ?? r.fileName, + (r) => r.fileName.split(path.sep).pop() ?? r.fileName, ), }); diff --git a/libs/native-federation-core/src/lib/utils/mapped-paths.ts b/libs/native-federation-core/src/lib/utils/mapped-paths.ts index ee674496..5a5a4137 100644 --- a/libs/native-federation-core/src/lib/utils/mapped-paths.ts +++ b/libs/native-federation-core/src/lib/utils/mapped-paths.ts @@ -13,10 +13,6 @@ export interface GetMappedPathsOptions { rootPath?: string; } -export function getSeparator(path: string) { - return path.includes('\\') ? '\\' : '/'; -} - export function getMappedPaths({ rootTsConfigPath, sharedMappings,