0

I am having an angular 14 application and a library in the same repo. I am using "@angular-architects/module-federation": "^14.3.14" and introduced modular federation in my angular application. I mapped my library path in my tsconfig like below: "paths": { "test/": [ "projects/test/", "dist/test" ] }

Before creation of the webpack file the above path mapping was working. But now it is throwing module not found error like below. compilerError

Not sure if the webpack files is not able to resolve my path properly.

Note: Getting this error only when rendering the testlib component in app.html. Importing the module or any service file from the library is working fine.

I have uploaded a sample application in my git hub page-https://github.com/JP-Jagadesan/mfe/tree/master

Jagadesan
  • 1
  • 1

1 Answers1

0
  1. you should go to webpack.config.js of your project and add sharedMappings there
const {
shareAll,
withModuleFederationPlugin,
} = require('@angular-architects/module-federation/webpack');

module.exports = withModuleFederationPlugin({
name: '...',

exposes: {
  ...
},

shared: {
  ...shareAll({
    singleton: true,
    strictVersion: true,
    requiredVersion: 'auto',
  }),
},
sharedMappings: ['test'], //<--this is the list of what you have in paths in tsconfig
});
  1. I think multiple mappings for paths are not supported yet - but you can give a try