forge
forge copied to clipboard
Production build unable to include Prisma
Pre-flight checklist
- [X] I have read the contribution documentation for this project.
- [X] I agree to follow the code of conduct that this project uses.
- [X] I have searched the issue tracker for a bug that matches the one I want to file, without success.
Electron Forge version
7.3.0
Electron version
v28.1.0
Operating system
macOS Sonoma 14.3.1
Last known working Electron Forge version
7.2.0
Expected behavior
After updating electron forge to latest (7.3.0) version, I would expect to have PrismaORM to work just as before, but it is not.
Actual behavior
After updating electron forge to latest (7.3.0) version, Prisma is not working in production build as it seems like it is not being included in the build.
Steps to reproduce
.
Additional information
My package.json
{ "name": "bla", "productName": "bla", "version": "1.0.0", "description": "My Electron application description", "main": ".vite/build/main.js", "license": "MIT", "keywords": [], "build": { "appId": "com.bla.financial", "extraResources": [ "prisma/**/*", "node_modules/.prisma/**/*", "node_modules/@prisma/client/**/*" ] }, "scripts": { "start": "env-cmd -f .env.development electron-forge start", "package": "electron-forge package", "make": "electron-forge make", "publish": "electron-forge publish", "lint": "eslint --ext .ts,.tsx .", "seed": "ts-node ./seed.ts", "reset:db": "npx prisma migrate reset && npm run seed", "format:code": "prettier --write .", "prepare": "husky" }, "lint-staged": { "src/**/*.{js,jsx,ts,tsx,json}": [ "eslint --fix --max-warnings=0" ], "src/**/*.{js,jsx,ts,tsx,json,css,scss,md}": [ "prettier --write" ] }, "devDependencies": { "@commitlint/cli": "^19.0.2", "@commitlint/config-conventional": "^19.0.0", "@electron-forge/cli": "^7.3.0", "@electron-forge/maker-deb": "^7.3.0", "@electron-forge/maker-rpm": "^7.3.0", "@electron-forge/maker-squirrel": "^7.3.0", "@electron-forge/maker-zip": "^7.3.0", "@electron-forge/plugin-auto-unpack-natives": "^7.3.0", "@electron-forge/plugin-fuses": "^7.3.0", "@electron-forge/plugin-vite": "^7.3.0", "@electron/fuses": "^1.7.0", "@types/node": "^20.10.5", "@typescript-eslint/eslint-plugin": "^5.62.0", "@typescript-eslint/parser": "^5.62.0", "autoprefixer": "^10.4.16", "electron": "28.1.0", "eslint": "^8.57.0", "eslint-config-prettier": "^9.1.0", "eslint-plugin-import": "^2.29.1", "eslint-plugin-prettier": "^5.1.3", "eslint-plugin-react": "^7.33.2", "eslint-plugin-react-hooks": "^4.6.0", "husky": "^9.0.11", "lint-staged": "^15.2.2", "postcss": "^8.4.32", "prettier": "^3.2.5", "prisma": "^5.8.1", "tailwindcss": "^3.4.0", "ts-node": "^10.9.2", "typescript": "~4.5.4", "vite": "^5.1.4" }, "dependencies": { "@emotion/react": "^11.11.3", "@emotion/styled": "^11.11.0", "@mui/icons-material": "^5.15.2", "@mui/material": "^5.15.2", "@mui/x-data-grid": "^6.18.6", "@mui/x-date-pickers": "^6.18.6", "@mui/x-tree-view": "^6.17.0", "@prisma/client": "^5.8.1", "@tailwindcss/forms": "^0.5.7", "@types/react": "^18.2.45", "@types/react-dom": "^18.2.18", "bcrypt": "^5.1.1", "electron-squirrel-startup": "^1.0.0", "env-cmd": "^10.1.0", "localforage": "^1.10.0", "match-sorter": "^6.3.1", "material-react-table": "^2.1.0", "moment": "^2.30.1", "prettier-plugin-organize-imports": "^3.2.4", "react": "^18.2.0", "react-dom": "^18.2.0", "react-router-dom": "^6.21.1", "react-select": "^5.8.0", "sort-by": "^1.2.0", "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz" } }
My default forge.config.ts
` import { MakerDeb } from '@electron-forge/maker-deb' import { MakerRpm } from '@electron-forge/maker-rpm' import { MakerSquirrel } from '@electron-forge/maker-squirrel' import { MakerZIP } from '@electron-forge/maker-zip' import { FusesPlugin } from '@electron-forge/plugin-fuses' import { VitePlugin } from '@electron-forge/plugin-vite' import type { ForgeConfig } from '@electron-forge/shared-types' import { FuseV1Options, FuseVersion } from '@electron/fuses'
const config: ForgeConfig = {
packagerConfig: {
asar: true,
},
rebuildConfig: {},
makers: [
new MakerSquirrel({}),
new MakerZIP({}, ['darwin']),
new MakerRpm({}),
new MakerDeb({}),
],
plugins: [
new VitePlugin({
// build
can specify multiple entry builds, which can be Main process, Preload scripts, Worker process, etc.
// If you are familiar with Vite configuration, it will look really familiar.
build: [
{
// entry
is just an alias for build.lib.entry
in the corresponding file of config
.
entry: 'src/main.ts',
config: 'vite.main.config.ts',
},
{
entry: 'src/preload.ts',
config: 'vite.preload.config.ts',
},
],
renderer: [
{
name: 'main_window',
config: 'vite.renderer.config.ts',
},
],
}),
// Fuses are used to enable/disable various Electron functionality
// at package time, before code signing the application
new FusesPlugin({
version: FuseVersion.V1,
[FuseV1Options.RunAsNode]: false,
[FuseV1Options.EnableCookieEncryption]: true,
[FuseV1Options.EnableNodeOptionsEnvironmentVariable]: false,
[FuseV1Options.EnableNodeCliInspectArguments]: false,
[FuseV1Options.EnableEmbeddedAsarIntegrityValidation]: true,
[FuseV1Options.OnlyLoadAppFromAsar]: true,
}),
],
}
export default config `