An example of a modern Next.js project configuration.
This example uses Yarn workspaces because that is what I'm familiar withM, but NPM also has workspaces nowadays and I would assume they are compatible.
For the stubborn who still like writing their code in plain Javascript, you can
check out the topic/js-only
branch to see a working example before I've
converted it to Typescript.
- ES Modules
- Monorepo using Yarn or NPM workspaces
- Typescript with project references and incremental compilation
- Next.js 11 (including Webpack 5 and ESLint)
- Run
yarn install
or justyarn
in the root cd packages/nextjs-app/
yarn dev
to start the dev server- Then access http://localhost:3000/
The page should display "Importing an ES6 module in Next.js via ESM worked!".
@TODO try it out
- Figure out if it is possible to automatically build package dependencies when compiling the app.
- Add path alias for ~/