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

SSR: Native Federation and Node.js Remote Loading #622

Open
klerick opened this issue Aug 18, 2024 · 0 comments · May be fixed by #623
Open

SSR: Native Federation and Node.js Remote Loading #622

klerick opened this issue Aug 18, 2024 · 0 comments · May be fixed by #623

Comments

@klerick
Copy link

klerick commented Aug 18, 2024

Hi @manfredsteyer

Currently, Native Federation does not support remote loading from Node.js directly. This limitation exists because Node.js does not allow the use of import('http://www.some.url/some-module.js').

However, we can work around this limitation by using the --loader flag and a custom loader for remote scripts. Native Federation can already create importmap.json and build projects to work with this import map. Additionally, it modifies the default Angular builder.

To enable Node.js to handle remote modules similarly to how it's done in the browser, we need to:

  1. Add external options for esbuild for the Node platform, similar to the browser platform.
  2. Set the minifyIdentifiers option to false.
  3. Apply all the configurations and changes currently done for the browser to the Node platform.
  4. Create a custom resolver and add an additional entry point.

By following these steps, we can launch SSR (Server-Side Rendering) after running the build command. However, understanding how the Angular development server works in this context can be challenging. I understand that this approach is a bit of a hack, but it can enable us to use SSR.

While I can create a custom resolver and modify Native Federation, I am having trouble understanding how to correctly change the Angular development server.

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