Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(nf): fix baseHref on build #419

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sokolovstas
Copy link

Pass baseHref to buildEsbuildBrowser options to transform index.html and ngsw.json generation

Pass baseHref to buildEsbuildBrowser to transform index.html <base href=""> and ngsw.json generation
@kryshac
Copy link

kryshac commented Mar 14, 2024

you also need to add to the schema

@manfredsteyer what do you think about this?

@aleksei-golubev
Copy link

Hi everyone, is it possible that this branch will be merge soon or is there any workaround for this?

We are using actively --base-href but after introducing Native Federation according this manual it is not recognizable anymore with Angular 17.

Thank you!

@kryshac
Copy link

kryshac commented Apr 18, 2024

for the moment I added this path:

@angular-architects+native-federation+17.1.7.patch

diff --git a/node_modules/@angular-architects/native-federation/src/builders/build/builder.js b/node_modules/@angular-architects/native-federation/src/builders/build/builder.js
index 44376e9..a5a0d64 100644
--- a/node_modules/@angular-architects/native-federation/src/builders/build/builder.js
+++ b/node_modules/@angular-architects/native-federation/src/builders/build/builder.js
@@ -63,6 +63,7 @@ function runBuilder(nfOptions, context) {
         const write = !runServer;
         const watch = !!runServer || nfOptions.watch;
         options.watch = watch;
+        options.baseHref = nfOptions.baseHref;
         const rebuildEvents = new rebuild_events_1.RebuildHubs();
         const adapter = (0, angular_esbuild_adapter_1.createAngularBuildAdapter)(options, context, rebuildEvents);
         (0, build_2.setBuildAdapter)(adapter);
diff --git a/node_modules/@angular-architects/native-federation/src/builders/build/schema.json b/node_modules/@angular-architects/native-federation/src/builders/build/schema.json
index 7fb73e7..705f991 100644
--- a/node_modules/@angular-architects/native-federation/src/builders/build/schema.json
+++ b/node_modules/@angular-architects/native-federation/src/builders/build/schema.json
@@ -42,6 +42,10 @@
     "skipHtmlTransform": {
       "type": "boolean",
       "default": false
-    }
+    },
+    "baseHref": {
+      "type": "string",
+      "description": "Base url for the application being built."
+    }
   }
 }

you can use this package to automate the process

@aleksei-golubev
Copy link

aleksei-golubev commented Apr 19, 2024

Thank you very much!
It works fine!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants