How to copy non-ts files to dist when building typescript?

You can also do this by adding an asset property in the nest-cli.json as mentioned in the documentation.

For your case, you can try something like this:

"assets":["**/Mail/templates/*"]

Or if your templates all have a specific filetype (I am assuming its called .template), this should also work:

"assets":["**/*.template"]

The 2nd example will copy all files of type .template from all sub directories to your dist folder with the same folder structure when you run a nest build. Similarly, you can use this to copy any filetype of your choice (.json, .proto, etc) by replacing .template in the glob pattern.

Leave a Comment