electron/remote

Facing issue in Production Build

pranavwani opened this issue · 7 comments

OS: Linux
App File Type: AppImage

Works perfectly in development, but after building the app it's throwing the following error. 🤔 how it works in development

FinalizationRegistry is not imported in server.js

A JavaScript error occurred in the main process
Uncaught Exception:
ReferenceError: FinalizationRegistry is not defined
    at Object.<anonymous> (/tmp/.mount_FirecaTEOaeb/resources/app.asar/node_modules/@electron/remote/dist/src/main/server.js:20:30)
    at Module._compile (internal/modules/cjs/loader.js:967:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1004:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module._load (electron/js2c/asar.js:769:28)
    at Module.require (internal/modules/cjs/loader.js:852:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/tmp/.mount_FirecaTEOaeb/resources/app.asar/node_modules/@electron/remote/dist/src/main/index.js:4:16)
    at Module._compile (internal/modules/cjs/loader.js:967:30)

What version of Electron are you using?

@nornagon Electron v12.0

@pranavwani strange, v12 definitely defines FinalizationRegistry. Would it be possible for you to provide a small example, perhaps using Electron Fiddle or based on electron-quick-start, that reproduces the issue?

FinalizationRegistry is defined by V8 itself, so it's surprising that this would be not defined.

@nornagon Sorry for late. I'll share the code base soon

I found that @electron/remote MUST be a dep (not a devDep) when working with webpack. Maybe that helps?

@nornagon @Nokel81 issue was fixed in the latest version: 1.2.1

I know this issue is closed, but if you find yourself running into this on latest versions, update your node environment. I ran into this on electron 16 and @electron/remote v2.0.1. Updating to node 16 fixed it for me.