我正在尝试为我的nestjs项目创建一个可执行文件,项目结构如下:
dist/
example/example.js
main.js
node_modules/
../nodemodule1
../nodemodule2
static/
..static files
ormconfig.json
tsconfig.json
package.json
我使用pkg
模块来创建可执行文件。我做了一些package.json
改变
"scripts":{
"start": "nest start",
"build": "nest build"
}
"bin":"dist/main.js",
"pkg": {
"assets": ["ormconfig.json", "static/*"],
"targets": [ "node14-win-x64" ],
"outputPath": "build"
}
在控制台中,我运行了以下命令并能够为 Windows 生成可执行文件。
pkg "dist/main.js" --config package.json
但是 ormconfig 和静态文件不包含在可执行文件中,并且会出现 orm 配置错误。谁能解释我在哪里做错了?
提前致谢