__dirname is not defined



  • New to Quasar and Electron. Creating my first Electron app from a Quasar project.

    If I set nodeIntegration: true in quasar.config.js , all works. However Electron security recommendation is for nodeIntegration: false.

    If I set nodeIntegration: false then when I build and sign the app (for Mac) I get the error:

    ReferenceError: __dirname is not defined
        at Module.10d0 (2.js:1)
    

    and the result is the app does not work correctly.

    The code at that reference position is:

    APP_URL:"file://"+__dirname+"/index.html"}).
    

    Is there a way to work around this?

    (Note: all works correctly running quasar dev -m -electron. The issue is in quasar build -m - electron).

    Thanks.


Log in to reply