Giter Club home page Giter Club logo

Comments (8)

ScriptedAlchemy avatar ScriptedAlchemy commented on May 29, 2024

I need to write a plugin for next js. Next uses a single runtime chunk which moves all the Federation code into the main runtime. In reality I need a special runtime created that’s not bound to the normal webpack runtime

from module-federation-examples.

hkundnani avatar hkundnani commented on May 29, 2024

Thanks.. May be I will wait for the plugin then.

from module-federation-examples.

ScriptedAlchemy avatar ScriptedAlchemy commented on May 29, 2024

You can make a shim for next.js. It’s what I use in production

from module-federation-examples.

Kinbaum avatar Kinbaum commented on May 29, 2024

@ScriptedAlchemy Do you have any documentation / resources on how to do this?

from module-federation-examples.

ScriptedAlchemy avatar ScriptedAlchemy commented on May 29, 2024

https://gist.github.com/ScriptedAlchemy/d386a094832dbd9a04324862d26570e9

window.abtests needs to be replaced with window.[remote]

from module-federation-examples.

Kinbaum avatar Kinbaum commented on May 29, 2024

@ScriptedAlchemy Would you happen to have an example of federating pages between two separate next applications? I could see this being very useful where you would have a main shell application with some kind of discovery service that is able to locate different remotes and include their pages. Similar to the way zones work with next js, but truly a single-page experience.

I have a discovery service working for components / routes outside of the next js framework.

from module-federation-examples.

ScriptedAlchemy avatar ScriptedAlchemy commented on May 29, 2024

all examples are proprietary and in-house to solve legacy WP4 and next js. Nothing demoed in repos mostly because I don’t use WP4 anymore lol. you pretty much paste the gist into a js file and add it as a new entrypoint then change the importAll context around based on what you want to expose to other remotes. You will need to load more than one file tho. 1 the runtime chunk next makes, 2 the remote entry containing the shim along with it dynamic importing all the pages via require.context, ugly but works

from module-federation-examples.

ScriptedAlchemy avatar ScriptedAlchemy commented on May 29, 2024

Closing these as its a separate series of problems that will arise. There is a next.js example available now

from module-federation-examples.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.