From 2d08ba7094150c74b322fe9f2f63eb4fe2d87419 Mon Sep 17 00:00:00 2001 From: Marcelo Shima Date: Tue, 24 Oct 2023 12:03:29 -0300 Subject: [PATCH] try with window.location.origin --- .../src/main/webapp/app/core/microfrontend/index.ts.ejs | 6 +++--- generators/angular/templates/tsconfig.json.ejs | 2 ++ .../angular/templates/webpack/webpack.microfrontend.js.ejs | 1 + 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/generators/angular/templates/src/main/webapp/app/core/microfrontend/index.ts.ejs b/generators/angular/templates/src/main/webapp/app/core/microfrontend/index.ts.ejs index b920b4fe780a..ecfdad4cd82f 100644 --- a/generators/angular/templates/src/main/webapp/app/core/microfrontend/index.ts.ejs +++ b/generators/angular/templates/src/main/webapp/app/core/microfrontend/index.ts.ejs @@ -24,7 +24,7 @@ import type NavbarItem from 'app/layouts/navbar/navbar-item.model'; export const loadNavbarItems = async (service: string): Promise => importRemote<{ EntityNavbarItems: NavbarItem[] }>({ esm: true, - url: `./services/${service}/remoteEntry.js`, + url: `${window.location.origin}/services/${service}/remoteEntry.js`, scope: 'default', module: 'entity-navbar-items', }).then(({ EntityNavbarItems }) => EntityNavbarItems); @@ -33,7 +33,7 @@ export const loadNavbarItems = async (service: string): Promise => export const loadTranslationModule = async (service: string): Promise> => importRemote<{ LazyTranslationModule: Type }>({ esm: true, - url: `./services/${service}/remoteEntry.js`, + url: `${window.location.origin}/services/${service}/remoteEntry.js`, scope: 'default', module: 'translation-module', }).then(({ LazyTranslationModule }) => LazyTranslationModule); @@ -42,7 +42,7 @@ export const loadTranslationModule = async (service: string): Promise> export const loadEntityModule = async (service: string): Promise> => importRemote<{ EntityRoutingModule: Type }>({ esm: true, - url: `./services/${service}/remoteEntry.js`, + url: `${window.location.origin}/services/${service}/remoteEntry.js`, scope: 'default', module: 'entity-routing', }).then(({ EntityRoutingModule }) => EntityRoutingModule); diff --git a/generators/angular/templates/tsconfig.json.ejs b/generators/angular/templates/tsconfig.json.ejs index 496731e860c5..b5ebc810b03c 100644 --- a/generators/angular/templates/tsconfig.json.ejs +++ b/generators/angular/templates/tsconfig.json.ejs @@ -36,7 +36,9 @@ "useDefineForClassFields": false, "target": "es2022", "module": "es2020", +<%_ if (microfrontend) { _%> "skipLibCheck": true, +<%_ } _%> "types": [], "lib": ["es2018", "es2020", "dom"] }, diff --git a/generators/angular/templates/webpack/webpack.microfrontend.js.ejs b/generators/angular/templates/webpack/webpack.microfrontend.js.ejs index 9cb665358b7f..963774ff4152 100644 --- a/generators/angular/templates/webpack/webpack.microfrontend.js.ejs +++ b/generators/angular/templates/webpack/webpack.microfrontend.js.ejs @@ -27,6 +27,7 @@ module.exports = (config, options, targetOptions) => { }, resolve: { fallback: { + // Workaround https://github.com/module-federation/universe/issues/1575 path: false, }, },