angular-architects / module-federation-plugin

MIT License
735 stars 203 forks source link

Error Resolving Exposed Routes and Components in Native Federation Configuration #660

Closed CavidH closed 1 month ago

CavidH commented 1 month ago

For which library do you need help?

native-federation

Question

I am encountering an issue when trying to expose routes and components in my Native Federation configuration. Here’s the relevant part of my federation.config.js:

''' const { withNativeFederation, shareAll, } = require("@angular-architects/native-federation/config");

module.exports = withNativeFederation({ name: "MFE1",

exposes: { "./Component": "./src/app/app.component.ts", "./routes": "./src/app/app.routes.ts", },

shared: { ...shareAll({ singleton: true, strictVersion: true, requiredVersion: "auto", }), },

skip: [ "rxjs/ajax", "rxjs/fetch", "rxjs/testing", "rxjs/webSocket", // Add further packages you don't need at runtime ],

// Please read our FAQ about sharing libs: // https://shorturl.at/jmzH0 }); ''' image

When building the federation artifacts, I receive the following errors: INFO Building federation artifacts X [ERROR] Could not resolve "./src/app/app.routes.ts" X [ERROR] Could not resolve "./src/app/app.component.ts"

Angular version: 18 Native Federation version: 18.2.2

CavidH commented 1 month ago

image

PipeFTW commented 1 month ago

Did you try to change the path to something like: exposes: { './Component': './projects/todo/src/app/app.component.ts', } ./projects//src/app/app.component.ts