简体   繁体   中英

How to make a folder not compile to js using tsconfig

I'm trying to create a npx package and to do so, i need to convert my.ts files into.js. The application i am making basically spits out typeScript templates to users according to the options they select. So, in this app, basically there is a CLI ( index.ts ) and the 'templates' folder. If i nest all of this into a 'src' folder and add rootDir: "./src" to tsconfig , what i want in the end is tsconfig to not compile with the "./src/templates" folder but copy it in the "dist" folder it generates and compile the "index.ts" file only.

How can I achieve this?

To answer my own question in simple sense, you cannot selectively choose not to compile a certain folder included in rootDir . As a workaround for the problem though, what i did was compile index.ts file only into the dist folder and then copy the templates folder into the dist folder.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM