- quickstart monorepo example for react projects and vanillajs projects
-
tech-stack
- react 17
- typescript 4
- monorepo
- A mix of TypeScript and Javascript packages
- npm workspaces only, no lerna
- yarn workspace should work too, but not tested here
- webpack 5
- webpack config shared at top level with webpack-merge
- hot reloading with react-refresh-webpack-plugin
- babel
- react components lib is compiled with babel
- react app is compiled with webpack and babel-loader
- jest for testing
- styling
- support scss, css
- other dev tools
- eslint
- prettier
-
project-structure
- package-a: simple utils
- packages
- sample-app: simple react app
- sample-components: simple react components
-
all dependencies are hoisted to top-level
node_modulesusing npm workspaces(require npm 7+)- put all your deps of dev/build/test/engineering at top level
- requirements
- npm 7+
# npm install --legacy-peer-deps npm i npm start- open a browser and go to http://localhost:8999
-
npm 7 workspaces limitations
- no equivalent of
yarn workspaces run cmd - no equivalent of
yarn workspace workspaceName cmd
- no equivalent of
-
The
mainfield of allpackage.jsons points tosrcfor easier developmentimports in jest testing usemainimports in vscode ide usemainfor code jumpingimports in webpack usemodule
-
If you want to publish a package, it's better to point
maintodistin the package.json -
APP_ENVenvironment variable- if no value is set, building es6 and ts is supported, but not react
- if
react*is set, building react is supported - if
reacthotis set, react hot reloading is supported - see
babel.config.jsfile for details and package.json scripts for examples
-
new demo page
-
css url
- image url
-
storybook(too many breaking changes recently, not planned until stable)
- support component story format
- support mdx docs