@thhein04/state-lib
v0.0.1
Published
Signal-based shared state library for Angular v21 micro frontends.
Readme
@shared/state-lib
Signal-based shared state library for Angular v21 micro frontends.
Build
npx nx build state-libBuild output is published from dist/state-lib.
Private Registry Publish
Use either repo-level or user-level .npmrc:
registry=https://registry.example.com/
//registry.example.com/:_authToken=${NPM_TOKEN}
always-auth=truePublish command:
npm publish dist/state-lib --registry=https://registry.example.com/ --access=restrictedModule Federation Singleton Registration
Register the package as a strict singleton in host and remote webpack configs:
const { share, withModuleFederationPlugin } = require('@angular-architects/module-federation/webpack');
module.exports = withModuleFederationPlugin({
shared: share({
'@shared/state-lib': {
singleton: true,
strictVersion: true,
requiredVersion: 'auto',
},
}),
});This ensures all MFEs reuse one store instance in the browser.
Testing
npx nx test state-lib