2.17.2 • Published 7 years ago
react-scripts-ts-multi-app v2.17.2
IMPORTANT NOTE: This is a fork of create-react-app-typescript that allows for multiple apps to have shared build configuration and shared code.
- Each "child app" should have a folder as an immediate descendent of the frontend root, each with its own /src folder and tsconfig files. E.g.
create-react-app root
├── app1
│ ├── src
│ ├── tsconfig.json
│ └── tsconfig.test.json
├── app2
│ ├── src
│ ├── tsconfig.json
│ └── tsconfig.test.json
└── shared
├── src
└── tsconfig.test.jsonThe
test,build, andstarttasks accept an--appRootcommand line argument in order to specify which app you want to test/build/start. E.g.react-scripts-ts test --appRoot=app1 --env=jsdom.Two additional jest options are allowed to be specified via package.json since you'll most likely be using
pathsin the tsconfig files (modulePathsandmoduleNameMapper).
app1/tsconfig.json
{
"compilerOptions": {
"baseUrl": "..",
"paths": {
"shared/*": [ "shared/src/*" ],
"*": [ "app1/src/*" ]
}
}
}package.json
"jest": {
"modulePaths": [
"<rootDir>/src"
],
"moduleNameMapper": {
"shared/(.*)": "<rootDir>/../shared/src/$1"
},
"collectCoverageFrom": [
...react-scripts
This package includes scripts and configuration used by Create React App. Please refer to its documentation:
- Getting Started – How to create a new app.
- User Guide – How to develop apps bootstrapped with Create React App.