ipcRenderer and Platform Detection in Boot Files



  • Can someone tell me the correct way to achieve this:

    I have a Boot file called oauth/index.js:

    import { Platform } from 'quasar'
    const { ipcRenderer } = require('electron');
    
    class OAuth {
        
       // Send a message to electron
       storeAuthData () {
           if (Platform.is.electron) {
             ipcRenderer.send('setSecurePassword', password);
           }
       }
    
    }
    

    This works fine when I build Electron but when I build SPA or run ‘quasar dev’ I get the following error:
    Uncaught TypeError: fs.existsSync is not a function

    I opened a GitHub bug but I was told that I am not using Platform Detection correctly.

    Any ideas? Thanks.



  • Seems the only solution for the moment is to have two separate Boot files and perform platform detection within quasar.conf. I might need to rethink my oauth system.

    https://github.com/quasarframework/quasar/issues/4552


Log in to reply