'NestJS copy assets files
I'm working on an EmailModule that reads a pug template.
I couldn't get the build to include the *.pug templates file:
I have followed the instruction based on this: https://github.com/nestjs/nest-cli/issues/320
Adding the assets property in nest-cli.json
"email": {
"type": "library",
"root": "libs/email",
"entryFile": "index",
"sourceRoot": "libs/email/src",
"compilerOptions": {
"tsConfigPath": "libs/email/tsconfig.lib.json"
},
"assets": ["**/*.pug"]
},
Solution 1:[1]
The assets
property should be inside the compilerOptions
property
"email": {
"type": "library",
"root": "libs/email",
"entryFile": "index",
"sourceRoot": "libs/email/src",
"compilerOptions": {
"tsConfigPath": "libs/email/tsconfig.lib.json",
"assets": ["**/*.pug"]
}
},
Solution 2:[2]
This is bug with old nest-cli versions. I just updated this package to "@nestjs/cli": "^8.2.5", and everything worked fine with copying folders/subfolders/files.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Alfred |
Solution 2 | mr_squall |