添加了TypeOrm后,服务注入报错
veryws opened this issue · comments
goodunions commented
ArcherGu commented
这个是支持的,只不过这些原生的node库需要在 vite.config.ts
-> plugins
-> VitePluginElectronBuilder
中的 external
字段中添加进去,这样在构建的时候不会将他们也打包进去。
下面是我一个基于此模板写的项目中用到的一些库,大部分的原生库其实都是支持 electron/node
双环境的:
external: [
'modbus-serial',
'@serialport',
'@nestjs',
'typeorm',
'sqlite3',
]
你在写 nestjs
后端或者其他 node
后端的时候,其实也是这样的,它们仅仅构建你写的代码,而不会将相关的引用也包含进去,这个和前端是不一样的。