NestJS编译选项中的assets路径错误。

huangapple go评论97阅读模式
英文:

NestJS compilerOptions assets wrong path

问题

我不太知道如何解释,但基本上我有.hbs文件,邮件资源需要这些文件。通常,当我运行npm start run:dev时,这些文件不会被复制到dist文件夹中。所以我修改了nest-cli.json,像这样。

但现在我遇到的问题是它们被复制到的路径不正确。

这是我在根目录中的情况:

而这是它们被复制到的位置:

英文:

I don't really know hot to explain it but basically I have .hbs files which the mail resource needs. Normally they don't get copied into the dist folder when I run npm start run:dev. So I modified the nest-cli.json like this.

NestJS编译选项中的assets路径错误。

But now I have the problem that the patch which they are getting copied to are not correct.

This is how I have it in my root folder:

NestJS编译选项中的assets路径错误。

And this is where it gets copied to:

NestJS编译选项中的assets路径错误。

I´ve tried playing around with the assets path and searched for answers but I didn't find any other way of coping those files

答案1

得分: 2

"compilerOptions": {
"assets": [
{
"include": "/mail",
"outDir": "dist/mail",
"watchAssets": true
},
],
"watchAssets": true
}

请注意,在您的第一张图片中,mail 文件夹下的 templates 文件夹与您的第二张图片中的 mail/templates 相同。这是因为您在父文件夹下只有一个文件夹。

英文:
"compilerOptions": {    
"assets": [
  {
    "include": "/mail",
    "outDir": "dist/mail",
    "watchAssets": true
  },
],
"watchAssets": true
}

note that in your first image templates folder under mail folder is same as mail/templates in your second image. And this because you have only one folder under the parent folder

huangapple
  • 本文由 发表于 2023年1月10日 02:56:57
  • 转载请务必保留本文链接:https://go.coder-hub.com/75061804.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定