I'm using Angular 14 and module federation. How do I find the absolute path of my remote application from within my remote application? In my remote application, I expose the module using
module.exports = withModuleFederationPlugin({
name: 'checklogo',
exposes: {
'./Component': './src/app/app.component.ts',
'./start':'./src/app/my-products/my-products.module.ts'
},
shared: {
...shareAll({ singleton: true, strictVersion: true, requiredVersion: 'auto' }),
},
});
and then in my src/app/services I have this
@Injectable({
providedIn: 'root'
})
export class SettingsService {
...
public init() {
const absolutePath = ???
this.configuration = initFile(`${absolutePath}/config.json`);
In my shell application, I reference the remote module when I init my routes like so
const routes: Routes = [
{
...
{
path: 'my-products',
initChildren: () =>
initRemoteModule({
type: 'module',
remoteEntry: getRemoteEntryUrl(),
exposedModule: './start'
})
.then(m => m.MyProductsModule)
},
I don't quite know what to put in the "const absolutePath = ???" line of my "init" method within the service.