Josh Bowden
Josh Bowden

Reputation: 1342

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,

Upvotes: 0

Views: 1740

Answers (1)

danielv
danielv

Reputation: 3097

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.

Upvotes: 1

Related Questions