I am trying to get a better understanding of Webpack and MFE generally. In have build a react container with 2 react modules. It works great so far. I haven't finished to implement all the routing but each time I type something in the URL sush as:

http://localhost:4230/trainees/add

the browser try to fetch a new resources: fetching main.js

here is my MFE configuration:

        new ModuleFederationPlugin( {
            name : 'container',
            remotes : {
                trainer : 'trainer@http://localhost:4230/remoteEntry.js',
                trainee : 'trainee@http://localhost:4220/remoteEntry.js'
            },
            shared: ['react', 'react-dom', {
                'react-router-dom': {
                    singleton: true
                }
            }],
        })

if I try to go to the same url using <Nav>in the code, it works...

Is it a normal behavior?

Thanks

1

There are 1 answers

0
Spiiff77 On

Found it!

Was the historyApiFallback in the webpack file. I just set it to true:

 historyApiFallback: {
            index : true
 },