Adding a common module
Course: Turborepo and Monorepos - chapter 18
A lot of times you need a module that can be shared by both frontend and backend apps
- Initialize a
packages/commonmodule
cd packagesmkdir common- Initialize an empty node.js project
npm init -ynpx tsc --init- Change the name to
@repo/common - Export a few things from
src/index.ts
export const NUMBER = 1;- Add it to the
package.jsonof various apps (next app/react app/node app)
"@repo/common": "*",- Import it in there and try to use it
- Run npm install in root folder and see if it works as expected