简体   繁体   中英

How to move .env file into build folder with tsconfig

How does one move files that are not .ts or .js files from the root directory to the build directory using tsconfig.json ? I don't see any specific options for it. It would be good to move any non .js or .ts files

Cheers,

Transpiling typescript to javascript is done by the tsc executable (or using the typescript library directly) with the configuration in tsconfig , it's not supposed to handle general tasks of bundling/packaging.

If you need to perform additional tasks with your build, like copying files, you can:

  • Use npm run scripts to call tsc then copy files
  • Create a shell script
  • Use a bundler like webpack or rollup
  • Write your own builder using the typescript library to compile ts

For simple projects, start with npm or shell script. If your code is targeting browsers you will probably need a bundler anyway, so your file copying will be part of the bundling process.

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