NestJS - assets & views folder not being added to dist folder after build
My folder structure is similar to below:
/assets
/img
/fonts
/views
failure.hbs
success.hbs
/src
main.ts
/users
users.controller.ts
You can copy those folders into the dist
folder by adding these lines to your nest-cli.json
file:
"compilerOptions": {
"assets": [
{
"include": "../assets",
"outDir": "dist/public",
"watchAssets": true
},
{
"include": "../views",
"outDir": "dist/views",
"watchAssets": true
}
],
"watchAssets": true
}
I came to this thread for NestJS + EJS Setup (late to the party) and below is my directory structure.
/views
index.ejs
/src
main.ts
Note: after changing
compilerOptions
in "nest-cli.json" fixed the issue.
"compilerOptions": {
"assets": [
{
"include": "views",
"outDir": "dist",
"watchAssets": true
}
],
"watchAssets": true,
"deleteOutDir": true
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With