- Run
npx lerna init --independent
- Install yarn (check above link)
- Configure
lerna.json
andpackage.json
to support Yarn Workspaces
- Contains some default configuration such as
tsconfig, eslint...
- The
tsconfig
should contain thepaths
aliases
- Package containing a
Button.jsx
component - Regular node package intialized with
yarn init
- Update the
package.json (name, version, main, types)
fields tsconfig.json
extends the default config, and add thecomposite
optionyarn tsc
compiles the code
- Package containing a
Counter.jsx
component - Regular node package intialized with
yarn init
- Update the
package.json (name, version, main, types)
fields yarn add @lerna-monorepo/button
(first runyarn install
to generate symlink of local packages)tsconfig.json
extends the default config, and addreferences
pointing to the button/ packageyarn tsc
compiles the code
- Vite app initiliazed with
yarn create @vite/app core-app --template react-ts
yarn add @lerna-monorepo/button
links the button package to the core-app- The button can be used in the Vite app without further configuration since Vite is able to handle linked-deps at build time