Reference a static file in renderer process (Vue.js)


Hi everyone!

I’m starting with electron a vue and I’m trying to reference a static file from a vue component. I’ve create my project with vue-cli (3.0.0-beta.10) and added vue-cli-plugin-electron-builde.

The vue-cli documentation says how to reference a static file from a vue component. Basically read process.env.BASE_URL and the file is in http://localhost:8080/icons.svg.

Here is the problem, when I run the app in “web mode” this env variable exits, but not when I run the electron app.

How do I have to load this URL with the electron renderer process? I suppose that in electron the URL to static files works in another way, isn’t?

Here is a repo with this demo project:

You can run this commands in order to test the app:

npm run serve or yarn serve: Launch the web app
npm run serve:electron or yarn serve:electron: Launch the electron app

I hope you can help me. I’m very confused with this.

Thanks a lot!