Project Structure
Less 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
.tsfiles - It's common to put all these
.tsfiles in asrcfolder - We will also create a
publicfolder 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
includearray makes sure that only files within thesrcfolder are compiled - Executing the
tsc --watchcommand will now compile all files in thesrcfolder and put them in thepublicfolder