No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    ipcMain / ipcRenderer with Quasar/Electron

    Help
    3
    5
    2331
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • E
      Epo last edited by

      Hi,

      i have wraped my quasar app with electron and i want to use the ipcmain and ipcrenderer process.

      now ich have my project folder where i run: quasar dev
      and my electron folder within my project folder where i also run: quasar dev

      in myproject/electron/src/main.js file i do this:
      const {ipcMain} = require(‘electron’)

      and in one of my components i want to us the ipcRenderer like this.
      const {ipcRenderer} = require(‘electron’)

      But this end´s in an error—>

      This dependency was not found:

      • electron in ./~/babel-loader/lib!./~/vue-loader/lib/selector.js?type=script&index=0!./src/modules/time/components/UserAction.vue

      To install it, you can run: npm install --save electron

      Any idea??

      1 Reply Last reply Reply Quote 0
      • E
        Epo last edited by Epo

        Main Problem is: How can i import electron (in particular ipcRenderer) into one of my vuejs components???

        npm install --save-dev electron in my main project folder seems to be ignored due to some settings?

        I saw there is a devDependency like “quasar-electron-app”:“file:electron” but dont know how to use this?

        1 Reply Last reply Reply Quote 0
        • C
          canaillou last edited by

          Same problem here. I was able to install electron by specifying the version, with the command below:

          npm install --save electron@1.7.9
          

          But later on the require statement, the module fails to load (ENOENT on /path.txt). So I’m not sure about the way to use it…

          1 Reply Last reply Reply Quote 0
          • C
            canaillou last edited by

            Got it from this post ! Come back with the provided quasar-electron-app and add the following line to the build/webpack.base.conf.js of your root directory

            target: 'electron-renderer'
            1 Reply Last reply Reply Quote 0
            • T
              talhaHavadar last edited by

              Hi @Epo, I know it is too late but you may consider using electron’s preload js functionality. I had the same issue while trying to use ipcRenderer on vue side.

              in your electron source (src-electron) there is an option for BrowserWindow named ‘webPreferences’ and it has preload option.

              // in your main electron process.
              let win = main.win = new electron.BrowserWindow({
                  webPreferences: {
                    preload: require("path").join(__statics, "preload.js")
                  }
                  // eslint-disable-next-line prettier/prettier
                });
              
              // in your preload.js which is located under src/statics
              window.ipcRenderer = require("electron").ipcRenderer;
              

              When you apply the changes above you will be able to access ipcRenderer from vue side.

              1 Reply Last reply Reply Quote 0
              • First post
                Last post