错误,而 Package 电子应用程序使用electron-forge包含sqlite / better-sqlite模块

w8biq8rn  于 11个月前  发布在  Electron
关注(0)|答案(1)|浏览(146)

我试图打包我的应用程序使用electron-forge.当我运行npm run make命令的错误occure像this,但我不知道如何解决这个问题.
无论如何,如果需要,这里是我的package.jsonforge.config.js

package.json

{
  "dependencies": {
    "bcryptjs": "^2.4.3",
    "better-sqlite3": "^8.4.0",
    "body-parser": "^1.20.2",
    "connect-flash": "^0.1.1",
    "electron-squirrel-startup": "^1.0.0",
    "express": "^4.18.2",
    "express-session": "^1.17.3",
    "multer": "^1.4.5-lts.1",
    "pug": "^3.0.2"
  },
  "devDependencies": {
    "@electron-forge/cli": "^6.1.1",
    "@electron-forge/maker-deb": "^6.1.1",
    "@electron-forge/maker-rpm": "^6.1.1",
    "@electron-forge/maker-squirrel": "^6.1.1",
    "@electron-forge/maker-zip": "^6.1.1",
    "@types/better-sqlite3": "^7.6.4",
    "electron": "25.1.0"
  },
  "scripts": {
    "start": "electron-forge start",
    "package": "electron-forge package",
    "make": "electron-forge make"
  },
  "name": "dishub-admin",
  "version": "1.0.0",
  "main": "app.js",
  "keywords": [],
  "author": "Fath Elchaydir Yahya",
  "license": "ISC",
  "description": "Aplikasi DISHUB BATOLA"
}

字符串

forge.config.js

module.exports = {
  packagerConfig: {},
  rebuildConfig: {},
  makers: [
    {
      name: '@electron-forge/maker-squirrel',
      config: {},
    },
    {
      name: '@electron-forge/maker-zip',
      platforms: ['darwin'],
    },
    {
      name: '@electron-forge/maker-deb',
      config: {},
    },
    {
      name: '@electron-forge/maker-rpm',
      config: {},
    },
  ],
};

cbeh67ev

cbeh67ev1#

添加 webpack.main.config.jsexternals: ["better-sqlite3"],为我解决了这个问题

相关问题