One annoyance many developers face when using TypeScript is file layout within the IDE. TypeScript compiles from .ts files to multiple .js files which can clutter file hierarchy layout on the IDE interface. This can be resolved in one of two ways.
1. Change your output directory
Navigate to your tsconfig.json file and specify an output directory that is different to the location of your .ts files. This could be /dist or /build:2. Hide your .js files
Changing your output directory and moving your .js files can cause issues. For example an index.html page that references main.js will no longer work if you're now compiling to /dist/main.js. You may therefore consider whether you just want to hide your .js files from your IDE.In Visual Studio Code, go to File > Preferences > Settings or your .vscode\settings.json file and enter:
To hide .js files one file directory deeper, add further lines to your .json file with an additional /*:
Before
|
After
|
No comments:
Post a Comment