From 180de7b3533760cff87b78fb40776db0710ac077 Mon Sep 17 00:00:00 2001 From: Manfred Steyer Date: Sun, 21 Jan 2024 15:55:35 +0100 Subject: [PATCH] fix(nf): activate code splitting in esbuild adapter --- libs/native-federation/migrate-appbuilder.md | 1 + libs/native-federation/src/builders/build/builder.ts | 9 +++++++-- .../src/utils/angular-esbuild-adapter.ts | 1 + 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/libs/native-federation/migrate-appbuilder.md b/libs/native-federation/migrate-appbuilder.md index 0514174a..f1b47cae 100644 --- a/libs/native-federation/migrate-appbuilder.md +++ b/libs/native-federation/migrate-appbuilder.md @@ -7,6 +7,7 @@ This requires some changes in the `angular.json`. If you go with a default confi ``` ng g @angular-architects/native-federation:appbuilder ``` + You need to run this command for each application using Native Federation. For more advanced cases, please find a diff of the changes needed for this version: diff --git a/libs/native-federation/src/builders/build/builder.ts b/libs/native-federation/src/builders/build/builder.ts index 730f0483..05906309 100644 --- a/libs/native-federation/src/builders/build/builder.ts +++ b/libs/native-federation/src/builders/build/builder.ts @@ -63,11 +63,16 @@ export async function* runBuilder( let builder = await context.getBuilderNameForTarget(target); if (builder === '@angular-devkit/build-angular:browser-esbuild') { - logger.info('.: UPDATE NEEDED :.'); + logger.info('.: NATIVE FEDERATION - UPDATE NEEDED :.'); logger.info(''); logger.info("Since version 17.1, Native Federation uses Angular's"); logger.info('Application-Builder and its Dev-Server.'); - logger.info('Please update your project config, e.g. in angular.json'); + logger.info(''); + logger.info('If you are sill on Angular 17.0.x, please update to'); + logger.info('Angular 17.1.x or downgrade to Native Federation 17.0.x.'); + logger.info(''); + logger.info('For working with Native Federation 17.1.x (recommented), '); + logger.info('please update your project config, e.g. in angular.json'); logger.info(''); logger.info('This command performs the needed update for default configs:'); logger.info(''); diff --git a/libs/native-federation/src/utils/angular-esbuild-adapter.ts b/libs/native-federation/src/utils/angular-esbuild-adapter.ts index 550ff543..852b22cd 100644 --- a/libs/native-federation/src/utils/angular-esbuild-adapter.ts +++ b/libs/native-federation/src/utils/angular-esbuild-adapter.ts @@ -268,6 +268,7 @@ async function runEsbuild( 'async-await': false, 'object-rest-spread': false, }, + splitting: true, platform: 'browser', format: 'esm', target: ['esnext'],