I am using create-react-app
with TypeScript template to manage my React project (yarn create react-app my-app --template typescript
)
When I run react-scripts build
my code is built into /build
folder. How to customize this directory?
I tried to change outDir
of compilerOptions
in tsconfig.json
, but this seems ignored by CRA.
It seems impossible at this moment,
based on the QA: Use custom build output folder when using create-react-app
There are workarounds, however.
For example, you can build then move it
Inside package.json
"build": "react-scripts build && mv build docs"
Refer: issue: https://github.com/facebook/create-react-app/issues/1354
There are many other solutions there, find a suitable one would be good.