The Micro Frontends Workshop Slides
- Node LTS
- npm >= 7.24.2
- From the root of the project run
npm i. - To run an exercise, navigate to its folder and also run
npm startfrom there. - Run only
npm startto runstep 1exercise. - Note that the
src/step-...folders contain base code for solving exercises while the solutions can be found in the corresponding subdirectories within thesrc/solutionsfolder.
- From the root of the project run
npm start.
The Next.js apps (src/**/nextApp) use Next 16, but @module-federation/nextjs-mf@8.8.76 (the latest release) declares peerOptional next@"^12 || ^13 || ^14 || ^15". Because of this:
- Day-to-day
npm ciandnpm installwork, because npm installs frompackage-lock.jsonwithout re-checking that peer range. - Changing the
nextversion (by hand or through Dependabot) fails withERESOLVE. Dependabot can't regenerate the lockfile in this case, so its PRs change onlypackage.json, and CI fails onnpm ciwithMissing: next@x.y.z from lock file.
When bumping next:
- Bump it in all six
nextApp/package.jsonfiles together (src/step-0{2,3,4}-*/nextAppandsrc/solutions/step-0{2,3,4}-*/nextApp), so the workshop steps and solutions don't drift apart. - Update
package-lock.jsonby changing only thenext,@next/envand@next/swc-*entries (version,resolved,integrity) and thenextspec of eachnextAppworkspace. Take the values fromnpm view <pkg>@<version> dist.tarball dist.integrity, and checknpm view next@<version> optionalDependenciesfor changed ranges (e.g.sharp). See PR #957 for an example. - Run
npm ci, check that eachnextAppresolves the new version (node -p "require('next/package.json').version"from inside the app folder), then runnpm run lintandnpm run build.
Do not work around the conflict by regenerating the lockfile with:
--force: npm movesnextintonextApp/node_modules, andnpm cithen silently skips installing it. The lockfile looks valid, but the apps have nonext.--legacy-peer-deps: npm drops required peers such ashonoand@rspack/core.
CI only lints and builds the slides. It does not build the Next apps, so a broken install like the ones above passes CI.
Remove this section once @module-federation/nextjs-mf supports Next 16, or once the workshop stops using it.