question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to access electron "app" from vue?

See original GitHub issue

I’d like to display the app version in my ui. The version should come from package.json. However I can’t seem to access app from within my renderer components.

I’ve tried

<script>
  import app from 'electron'

  export default {

    data () {
      return {
        appVersion: app.getVersion()
      }
    },

I was considering importing package.json to read it directly from there but I’m not sure if this will work both in dev and build since package.json doesn’t get packaged (I’m using electron-builder)?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

25reactions
SimulatedGREGcommented, May 9, 2017

My mistake, I for some reason thought app was a shared module. You’ll need to access it from remote. In development you’ll probably get the version of electron being used, but in production you should get the version from package.json.

import { remote } from 'electron'

console.log(remote.app.getVersion())
3reactions
marceloavfcommented, Oct 21, 2017

Is that safe to use this approach of @n82, @SimulatedGREG ?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Building an app with Electron and Vue - LogRocket Blog
If you've worked with Vue before, it's simple to get started with Electron. Use the Vue CLI plugin for Electron Builder and make...
Read more >
Building Desktop Apps With Electron And Vue
This tool allows you to build Vue apps for desktop with Electron, this means that it makes your Vue application work as an...
Read more >
Create an Electron application with Vue and Vuetify - ITNEXT
With the help of Vue CLI you can now easily prepare the project. To do this, enter the following command: vue create vue-electron-app....
Read more >
Building a Desktop App with Electron and Vue.js - Buddy.Works
First, Node and NPM are required for developing and building your application. You can download both of them from the official website. You...
Read more >
Building an Electron App with VueJS and Vite
Their claim is to run the command vue add electron-builder to your existing application created using Vue CLI 3 or 4 and that's...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found