Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Can't use npm modules inside electron.js #50

Closed
simonwjackson opened this issue Oct 30, 2016 · 3 comments
Closed

Can't use npm modules inside electron.js #50

simonwjackson opened this issue Oct 30, 2016 · 3 comments
Labels

Comments

@simonwjackson
Copy link

Describe the issue / bug.

Can't use npm modules inside electron.js. (socket.io for example)

I know the node_modules are removed in the final build, but they seem to work only when included inside the Vue instance.

Is there some way i can still require these in electron.js?

How can I reproduce this problem?
npm install --save socket.io
cd app 
npm install --save socket.io
npm run build:win32
# then execute exe

/app/electron.js

const io = require('socket.io')
If visual, provide a screenshot.

image

Tell me about your development environment.
  • Node version: 6.5.0
  • NPM version: 3.10.8
  • Operating System: Win 10
@SimulatedGREG
Copy link
Owner

@simonwjackson

Any modules required within the scope of app/src/main.js will be bundled with webpack for the renderer process only. Modules required in app/electron.js will not work in production, after making a build. There's currently no plans to support bundling the main process at the moment (more info).

Related:
#22

@simonwjackson
Copy link
Author

Ok, i guess ill have to write a script to install dependencies after the build is complete since this is mission critical for my app.

Thanks or the update!

@SimulatedGREG
Copy link
Owner

Looking to bring electron-builder support soon, which should make external modules for main process a lot easier to manage. Not many boilerplates handle this well so there is some pioneering to do since webpack is involved. Thanks for understanding.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants