From b0af85a83b86465719438e5645ff84021117527f Mon Sep 17 00:00:00 2001 From: Alejandro Date: Sun, 10 Aug 2025 15:28:06 +0200 Subject: [PATCH 1/2] feat(nf): unhides bundle adapter errors when building artifacts --- .../lib/core/bundle-exposed-and-mappings.ts | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts b/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts index 9322a9f..ba9f12e 100644 --- a/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts +++ b/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts @@ -1,16 +1,16 @@ -import path from 'path'; import fs from 'fs'; +import path from 'path'; -import { NormalizedFederationConfig } from '../config/federation-config'; -import { FederationOptions } from './federation-options'; -import { bundle } from '../utils/build-utils'; import { ExposesInfo, SharedInfo } from '@softarc/native-federation-runtime'; +import { NormalizedFederationConfig } from '../config/federation-config'; import { createBuildResultMap, lookupInResultMap, } from '../utils/build-result-map'; +import { bundle } from '../utils/build-utils'; import { logger } from '../utils/logger'; import { normalize } from '../utils/normalize'; +import { FederationOptions } from './federation-options'; export interface ArtefactInfo { mappings: SharedInfo[]; @@ -40,7 +40,9 @@ export async function bundleExposedAndMappings( logger.info('Building federation artefacts'); - const result = await bundle({ + let result; + try { + result = await bundle({ entryPoints, outdir: fedOptions.outputPath, tsConfigPath: fedOptions.tsConfig, @@ -50,8 +52,12 @@ export async function bundleExposedAndMappings( mappedPaths: config.sharedMappings, kind: 'mapping-or-exposed', hash, - optimizedMappings: config.features.ignoreUnusedDeps, - }); + optimizedMappings: config.features.ignoreUnusedDeps, + }); + } catch (error) { + logger.error('Error building federation artefacts'); + throw error; + } const resultMap = createBuildResultMap(result, hash); From c502d7815aae1b7a61ed60eb3f02ec8e6b264784 Mon Sep 17 00:00:00 2001 From: Alejandro Date: Sun, 10 Aug 2025 15:31:45 +0200 Subject: [PATCH 2/2] chore: tabs --- .../lib/core/bundle-exposed-and-mappings.ts | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts b/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts index ba9f12e..f6335c7 100644 --- a/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts +++ b/libs/native-federation-core/src/lib/core/bundle-exposed-and-mappings.ts @@ -43,15 +43,15 @@ export async function bundleExposedAndMappings( let result; try { result = await bundle({ - entryPoints, - outdir: fedOptions.outputPath, - tsConfigPath: fedOptions.tsConfig, - external: externals, - dev: !!fedOptions.dev, - watch: fedOptions.watch, - mappedPaths: config.sharedMappings, - kind: 'mapping-or-exposed', - hash, + entryPoints, + outdir: fedOptions.outputPath, + tsConfigPath: fedOptions.tsConfig, + external: externals, + dev: !!fedOptions.dev, + watch: fedOptions.watch, + mappedPaths: config.sharedMappings, + kind: 'mapping-or-exposed', + hash, optimizedMappings: config.features.ignoreUnusedDeps, }); } catch (error) { @@ -76,8 +76,8 @@ export async function bundleExposedAndMappings( dev: !fedOptions.dev ? undefined : { - entryPoint: normalize(path.normalize(item.fileName)), - }, + entryPoint: normalize(path.normalize(item.fileName)), + }, }); } @@ -90,10 +90,10 @@ export async function bundleExposedAndMappings( dev: !fedOptions.dev ? undefined : { - entryPoint: normalize( - path.join(fedOptions.workspaceRoot, item.fileName) - ), - }, + entryPoint: normalize( + path.join(fedOptions.workspaceRoot, item.fileName) + ), + }, }); } @@ -117,8 +117,8 @@ export function describeExposed( dev: !options.dev ? undefined : { - entryPoint: localPath, - }, + entryPoint: localPath, + }, }); } @@ -142,8 +142,8 @@ export function describeSharedMappings( dev: !fedOptions.dev ? undefined : { - entryPoint: normalize(path.normalize(m.path)), - }, + entryPoint: normalize(path.normalize(m.path)), + }, }); }