Creating the Microfrontend Production build
As you may recollect, so far, we’ve only run and tested our microfrontends in development mode, using the nx serve command. For us to deploy applications to a hosting server, they need to be built in production mode.
This is usually quite straightforward in regular React apps, but with our microfrontends, it needs a bit more work.
Open up the ebuy app we built in Chapter 5 and follow these steps. Let's first create a script command to build all our apps:
- Open up the
package.jsonfile on the root and just like theserve:allcommand, let's create a new command forbuild:allas follows:"build:all": "nx run-many --target=build"
- Run the
pnpm build:allcommand and let us see whether all the apps build. Oops! You’ll notice while all the other apps built fine,app-shellthrew out some error about not being able to findcatalog/Moduleorcheckout/Module, and so on.Let's dig a bit into...