title: Issue sharing custom libraries with Module Federation plugin
body: <p>Good afternoon,</p>
  <p>I followed this <a href="https://github.com/angular-architects/module-federation-plugin/blob/12.0.0/libs/mf/tutorial/tutorial.md" rel="nofollow noreferrer">tutorial</a> to share a library with Module Federation Plugin and Angular. Library is located in a different projects (not monorepo), and it is installed as npm dependency in two modules. I want to use this library to share data, so it contains a service with get/set methods to store values in a private variable.</p>
  <p>Issue comes when I use the library in two modules. Looks like it is instantiated two times, because if I print the value in both modules, it has two different values at same time.</p>
  <p>I´m using this config for the main module:</p>
  <pre><code>sharedMappings.register(
    path.join(__dirname, 'tsconfig.json'),
    ['authentication-lib']);
  
  module.exports = {
    output: {
      uniqueName: &quot;crmEcApp&quot;,
      publicPath: &quot;auto&quot;
    },
    optimization: {
      runtimeChunk: false
    },
    resolve: {
      alias: {
        ...sharedMappings.getAliases(),
      }
    },
    experiments: {
      outputModule: true
    },
    plugins: [
      new ModuleFederationPlugin({
          library: { type: &quot;module&quot; },
           remotes: {
               &quot;userManagementApp&quot;: &quot;userManagementApp@http://localhost:4501/remoteEntry.js&quot;,
  
           },
  
          shared: share({
            &quot;@angular/core&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;@angular/common&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;@angular/common/http&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;@angular/router&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;authentication-lib&quot;: { singleton: true, eager:true, strictVersion: true, requiredVersion: 'auto' },
  
            ...sharedMappings.getDescriptors()
          })
  
      }),
      sharedMappings.getPlugin()
    ],
  };
  </code></pre>
  <p>And this config for the second module:</p>
  <pre><code>sharedMappings.register(
    path.join(__dirname, 'tsconfig.json'),
    ['authentication-lib']);
  
  module.exports = {
    output: {
      uniqueName: &quot;userManagementApp&quot;,
      publicPath: &quot;auto&quot;
    },
    optimization: {
      runtimeChunk: false
    },
    resolve: {
      alias: {
        ...sharedMappings.getAliases(),
      }
    },
    experiments: {
      outputModule: true
    },
    plugins: [
      new ModuleFederationPlugin({
          library: { type: &quot;module&quot; },
  
          // For remotes (please adjust)
           name: &quot;userManagementApp&quot;,
           filename: &quot;remoteEntry.js&quot;,
           exposes: {
             './UserManagementComponent': './/src/app/user-management/user-management.component.ts',
             './AuthModule': './/src/app/app.module.ts'
           },
  
          shared: share({
            &quot;@angular/core&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;@angular/common&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;@angular/common/http&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;@angular/router&quot;: { singleton: true, strictVersion: true, requiredVersion: 'auto' },
            &quot;authentication-lib&quot;: { singleton: true, eager: true, strictVersion: true, requiredVersion: 'auto' },
  
            ...sharedMappings.getDescriptors()
          })
  
      }),
      sharedMappings.getPlugin()
    ],
  };
  </code></pre>
  <p>Library that I´m trying to share is authentication-lib.</p>
  <p>Thanks.</p>
  <p><strong>Update: added service</strong></p>
  <pre><code>@Injectable({ providedIn: 'root' })
  export class AuthService {
    isAuthenticated: boolean = false;
  </code></pre>