electron-pos-printer icon indicating copy to clipboard operation
electron-pos-printer copied to clipboard

ReferenceError: require is not defined

Open MahmoudMm opened this issue 3 years ago • 3 comments

Hi, 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

MahmoudMm avatar Dec 13 '21 07:12 MahmoudMm

You have to add the contextIsolation in BrowserWindow like:

webPreferences: {
    contextIsolation: false,
}

buibr avatar Dec 30 '21 07:12 buibr

as you can see my electron webPreferences is webPreferences: { nodeIntegration: true, contextIsolation: false, enableRemoteModule: true, }, I set contextIsolation to false,

MahmoudMm avatar Jan 13 '22 21:01 MahmoudMm

Hello @janafsal, @MahmoudMm and @buibr, Please excuse my late replies. You don't need to edit and recompile anymore, I have updated the package. It is compatible with the latest version of electron

Hubertformin avatar Oct 27 '22 13:10 Hubertformin

Hello @janafsal, @MahmoudMm and @buibr, Please excuse my late replies. You don't need to edit and recompile anymore, I have updated the package. It is compatible with the latest version of electron

@Hubertformin thank you so much for your kind response…😊

janafsal avatar Oct 27 '22 13:10 janafsal

You're welcome.

Hubertformin avatar Oct 27 '22 13:10 Hubertformin