Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Readme: Add options object to require statement #26

Closed
wants to merge 1 commit into from
Closed

Fix Readme: Add options object to require statement #26

wants to merge 1 commit into from

Conversation

JAFB321
Copy link

@JAFB321 JAFB321 commented Feb 22, 2022

The hot reloader doesn't work when you use the require snippet from the readme:

try {
	require('electron-reloader')(module);
} catch {}

If print the error log, It throws the following error:

TypeError: Cannot read properties of undefined (reading 'ignored')
    at module.exports (/media/jafb-disk/personal-projects/filelify/node_modules/electron-reloader/index.js:45:14)
    at Object.<anonymous> (/media/jafb-disk/personal-projects/filelify/main.js:23:33)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1169:10)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Module._load (node:internal/modules/cjs/loader:829:12)
    at Function.c._load (node:electron/js2c/asar_bundle:5:13331)
    at loadApplicationPackage (/media/jafb-disk/personal-projects/filelify/node_modules/electron/dist/resources/default_app.asar/main.js:110:16)
    at Object.<anonymous> (/media/jafb-disk/personal-projects/filelify/node_modules/electron/dist/resources/default_app.asar/main.js:222:9)
    at Module._compile (node:internal/modules/cjs/loader:1116:14)

But if you pass the 2nd parameter (options param) as a empty object, there is no problem 👍🏻:

try {
   require('electron-reloader')(module, {});
} catch {}

This look like a simple problem which will be solved, but this documentation fix should help temporarily 😄

PD:
The real problem seems to be here, but I don't wanted to change the code, I decided to let the dev do his job 😸
image

@sindresorhus
Copy link
Owner

It's a bug and fixed now.

@JAFB321 JAFB321 deleted the fix-readme branch February 22, 2022 19:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants