jooy2 / retron

📑 Vite + React + Electron + Material-UI Template. This is a skeleton template for easily creating React-based Electron projects.
MIT License
38 stars 4 forks source link

Thermal Printer package issue #169

Open NooberMe opened 1 year ago

NooberMe commented 1 year ago

Describe the bug

when i try to use any thermal printer package this buffer issue come out, Uncaught Error: Dynamic require of "buffer" is not supported , when i try to install react-thermal-printer/electron-pos-printer To Reproduce Install any thermal printer package like electron-pos-printer

image

NooberMe commented 1 year ago

I also tried to use 16.20.1 node version and latest version of node 18.17 but still have that error.

jooy2 commented 1 year ago

Hello, thank you for using Retron template!

I don't know much about the electron-pos-printer module, but I've seen a lot of installation issues registered as GitHub Issues. Can you determine if this module is working properly in the latest electron environment?

Also, here are some speculative causes:

  1. Retron is optimized for ESM and you may need to use import instead of require.
  2. some modules should be run in the Main process instead of running in the Renderer process.

If you're still experiencing issues, I'd like you to share a simple Electron project that I can reproduce.

Regards,

NooberMe commented 1 year ago

hi, thank you for your response,

I also try some of thermal printer package and still have error in "Dynamic require", and in my code i didnt use require, the issue came from node modules. im almost 80% of my project but im looking forward to find out how to fix the "Dynamic require"