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.json
file on the root and just like theserve:all
command, let's create a new command forbuild:all
as follows:"build:all": "nx run-many --target=build"
- Run the
pnpm build:all
command and let us see whether all the apps build. Oops! You’ll notice while all the other apps built fine,app-shell
threw out some error about not being able to findcatalog/Module
orcheckout/Module
, and so on.Let's dig a bit into...