You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently using node-printer in a React Tauri Typescript project, I'm doing the following:
import{printDirect}from"@thiagoelg/node-printer";//...exportconstprintTicket=(ticket: any)=>{printDirect({data: ticket,printer: "XP58",type: "RAW",options: {},success: function(jobID){console.log("sent to printer with ID: "+jobID);},error: function(err){console.log(err);},});};
At first I got an error about dirname not being defined. I fixed it by adding these three lines to the printer.js:
import*asurlfrom'url';//added to fix dirname errorconst__filename=url.fileURLToPath(import.meta.url);const__dirname=url.fileURLToPath(newURL('.',import.meta.url));varprinter_helper={},fs=require("fs"),child_process=require("child_process"),os=require("os"),path=require("path"),binding_path=path.resolve(__dirname,'./node_printer.node'),printer_helper;
Afterwards, I started getting this error:
Uncaught SyntaxError: The requested module '/node_modules/.vite/deps/@thiagoelg_node-printer.js?v=e75f09bd' does not provide an export named 'default' (at index.ts:1:1)
Any idea as to how to fix it? Or should I stick with Electron instead of Tauri?
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Currently using node-printer in a React Tauri Typescript project, I'm doing the following:
At first I got an error about dirname not being defined. I fixed it by adding these three lines to the printer.js:
Afterwards, I started getting this error:
Any idea as to how to fix it? Or should I stick with Electron instead of Tauri?
Thanks in advance!
The text was updated successfully, but these errors were encountered: