Native dependencies in electron wrapper
Hi, I have a fresh install of quasar default starter kit with default electron wrapper.
Im trying to:
Import http from ‘http’ in App.vue
Which of course dont work in browser,
but it does also not work in electron when running quasar dev in electron folder.
I tried to change target to ‘node’ in webpack conf in root folder which make it work, but then require doesnt work anymore and vue wont load. (But it does load http thought and electron app does run / work)
How to use target ‘node’ in webpack config without break quasar / vue? Or how to use http in electron app? I cant figure out the right config.
You can probably
npm install --save http
Are you sure you want the node http module, not something like axios?
I need several native dependecies including exec, net etc… Is there no way to config it to get it work with target node?
The thing is, an electron app is nothing if not a barebone chrome browser. I’m still not sure what you want to do.
Probably not a good idea to try to serve files from a client app. Would having a node backend with an express server be an option?
Now I get more of the electron lib idea.
I found several helpful information ex.
For exec on mac:
Btw. serve files from a client app should not be an issue. Its done in almost every game which acts both like a client and a server.
I need my applications both to serve and be served ;)
Im sorry, I think my problem still persist.
The problem is that electron actually does run and executes my code:
import net from ‘net’;
net.createServer (…); // etc… (this executes when webpack target is node)
But vue does not load because native node doesnt recognize require() which is used in main.js etc…
Any1 made this work with quasar? I got it work using electron-vue, but it would help alot more if it worked with quasar also.
Have you looked at sockets.io?
If you do not know how to setup config to use quasar electron with target node in webpack, or can not show me how to use native node libs in electron quasar, please do not respond. Thank you.
@benoitranque and yes I want http module ( tcp/ip ) controll not axios. Im targetting the computer hardware, not other clients only.
Im, sorry but this is not electron related, electron runs as it should. I think the problem is the configuration of quasar by how webpack and babel is configured.