Project Structure
January 30, 2024Less than 1 minute
Project Structure
- In this chapter we provide you with a best practice setup for your TS project
src & public
- All the programming stuff is done in
.ts
files - It's common to put all these
.ts
files in asrc
folder - We will also create a
public
folder to store the compiled files - This is typically done to have a folder that can be directly deployed on the internet
- Let's rearrange our project structure:
project structure - And add some config options to
tsconfig.json
:
{
"compilerOptions": {
"target": "ESNext",
"lib": ["DOM", "ES2017"],
"rootDir": "./src",
"outDir": "./public"
},
"include": [
"src"
],
}
- The
include
array makes sure that only files within thesrc
folder are compiled - Executing the
tsc --watch
command will now compile all files in thesrc
folder and put them in thepublic
folder