引入 sqlite3 报错问题
jack-pearson opened this issue · comments
你好, 项目中安装 sqlit3 插件, 再 app.controller.ts 中的顶部引入 const sqlite3 = require("sqlite3").verbose(); 进行使用.
发现有报错
[main] App threw an error during load
[main] Error: package.json does not exist at /Users/liu/project/fast-vite-nestjs-electron/dist/package.json
[main] at Object.exports2.find (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:10682:15)
[main] at node_modules/sqlite3/lib/sqlite3-binding.js (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:10901:31)
[main] at __require2 (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:16:44)
[main] at node_modules/sqlite3/lib/sqlite3.js (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:10951:19)
[main] at __require2 (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:16:44)
[main] at src/main/app.controller.ts (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:11156:19)
[main] at __require2 (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:16:44)
[main] at src/main/app.module.ts (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:11351:28)
[main] at __require2 (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:16:44)
[main] at Object. (/Users/liu/project/fast-vite-nestjs-electron/dist/main/index.js:11371:29)
我看了打包过后的文件, 发现 这个包引入了package.json
但是我不知道如何解决, 您可以帮忙看看么?🙏🙏🙏
好了 已经找到了. 需要 external 一下 就可以了.