Skip to content

19.0.10

Compare
Choose a tag to compare
@manfredsteyer manfredsteyer released this 16 Feb 12:28
· 17 commits to main since this release

Big thanks to our contributors!

Features

feat(nf-runtime): added cacheTag option

initFederation now has a cacheTag option. If you set it, e.g., to Date.now(), it will be appended to the URLs of the fetched remoteEntries.json files to prevent caching.

Big thanks to Alain Sollberger for this contribution!

feat(nf): allow to version repo-internal libs (mapped paths)

We can now assign a version number to monorepo-internal libs (mapped paths). This allows to detect conflicts in cases where different micro frontends of the same monorepo were deployed independently and a shared internal lib was changed in between the two deployments.

To use this feature, just assign a version number in the libs package.json and activate the new feature using the new feature map:

module.exports = withNativeFederation({

  [...]

  features: {
    mappingVersion: true,
  },
  
});

The new feature map activates features that might cause breaking changes. Without explicitly activating these features, the usual backwards-compatible behavior is used.

feat(nf): Allow building dev bundles without using the dev-server

So far, the dev option activated both, producing dev bundles and starting the dev server. The new devServer flag allows to opt out of using the dev server so that dev bundles end up in the `dist folder.

"build": {
	"builder": "@angular-architects/native-federation:build",
	"options": {},
	"configurations": {
		"production": {
			"target": "demo:esbuild:production"
		},
		"development": {
			"target": "demo:esbuild:development",
			"dev": true
		},
		"dev-bundles": {
			"target": "demo:esbuild:development",
			"dev": true,
			"devServer": false
		}
	},
	"defaultConfiguration": "production"
},

In this case, you can run the additional configuration using ng run demo:build:dev-bundles.

feat(nf-core): add externals config option to manually add externals

The federation config now has an externals flag to add app-specific externals. These are libs that are excluded when creating the bundles. This can be used, for example, to ignore optional dependencies some of your shared libraries reference.

At first glance, ´externalsseems to work similarly to theskip` flag. However, there are differences:

  • skip: The mentioned packages are skipped from sharing. Hence, they end up in the application bundles
  • external: The mentioned packages are not build at all.

feat(nf-core): Skip node libs by default when build for the browser

So far, Native Federation has had issues when detecting Node.js-based libs when building for the browser. The solution was to skip such libs or to move them to the devDependencies not discovered by the shareAll helper. The latter one is the right solution for build-time libs anyway.

Now, to streamline this, Native Federation is excluding all Node.js-based libraries when building for the browser.

feat(nf): add build flag with options default and separate

Before, all deps were built together to improve build performance. Now, you can set the new option build found in the share config to separate for selected shared deps. In this case, they will be built separately. This is necessary in rare cases, e.g., where a lib imports parts of itself using its official package name.

As Native Federation uses externals such imports would not be bundled in when built together with other deps. However, if we build it separately, we can remove itself from the external list for this one build.

feat(nf): add platform flag

There is now a platform flag in the shared config that can be set to node or browser so that the shared dependency is built for the respective platform. For some Angular-internal libs such as @angular/platform-server or @angular/ssr platform=node is assumed automatically. Internally, a constant `DEFAULT_SERVER_DEPS_LIST´ is used to identify them.

Docs

docs(nf): mention demo repo

Our readme now points to our new example repo that shows how to use Native Federation with popular UI libs: ag-grid, Angular Material, VMWare Clarity, Kendo UI, ng-bootstrap, ng-zorro, primeng.

Fixes

fix(nf): update script tags in place to respect #733

This solves issues with using deployUrl option provided by the Angular CLI.

fix(nativeFederation): fixes the missing behaviour of the param outputPath

We now can directly set the outputPath property for the NativeFederationBuilder.

Big thanks to Alejandro for this contribution.

fix(nf): backslashes not converted to slashes in sub dependency paths

Big thanks to Bernd Konnerth for the PR with this fix!