ReferenceError: require is not defined
See original GitHub issueHi, I am having a trouble where I can’t print or preview the request
when printing it says “TimedOut” and when previewing the error in developer tools is
Uncaught ReferenceError: require is not defined at body-init.js:5
my electron webPreferences is
webPreferences: { nodeIntegration: true, contextIsolation: false, enableRemoteModule: true, },
it seems the problem is with integration with electron 16 as fssonca’s demo worked fine with me when upgrading to electron 16 it crashed.
Node: v16.13.1 electron: v16.0.2 electron-pos-printer: v1.2.4
Issue Analytics
- State:
- Created 2 years ago
- Reactions:3
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Client on Node.js: Uncaught ReferenceError: require is not ...
However, require is not defined on the client side, and it throws an error of the form Uncaught ReferenceError: require is not defined...
Read more >ReferenceError: require is not defined in JavaScript - Stack Diary
The "ReferenceError: require is not defined" error occurs when the require function is used in a JavaScript file that is intended to be ......
Read more >How to fix "require is not defined" in JavaScript / Node.js?
In our case, the error message is “require is not defined” which indicates the problem is with the variable or method named “require”....
Read more >How To Fix ReferenceError require is not defined in JavaScript
In this case, check your package.json file for an property called type . If that is set to module , ES6 modules will...
Read more >ReferenceError: require is not defined in JavaScript | bobbyhadz
To solve the "ReferenceError require is not defined" error, use the ES6 module import and export syntax. The require() function is Node.js specific...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
We need to edit pos-printer.ts and compile again (or) edit pos-printer.js in dist directly. Add webPreferences: { nodeIntegration: true, contextIsolation: false, }
You’re welcome.