Browserify: using browserify with electron

Created on 20 Nov 2015  路  7Comments  路  Source: browserify/browserify

I'm building react based desktop pplication with github electron. Electron allow to use node.js features in browser code. However I still need browserify for compile react files.

The issue is that with standard browserify policies node code goes invalid. require no longer work as expected, __filename and __dirname start showing things which is not close to 'on-disk' reality, etc.

Is there is any kind of vision how it's possible to friend electron with browserify?

Most helpful comment

Uncaught Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

Error thrown when trying this when using browserify+vue on my app.js:

"browserify": "browserify -t vueify browserify --ignore-missing --no-builtins --no-commondir --insert-global-vars=\"global\" --no-browser-field -e app.js -o resources/bundle.js --debug",

All 7 comments

window.require, window.__filename, and window.__dirname

Try this:

browserify --no-builtins --no-commondir --insert-global-vars="global" app.js

Can I do this from gulpfile? I mean browserify my nodejs application using gulp?

Uncaught Error: Electron failed to install correctly, please delete node_modules/electron and try installing again

Error thrown when trying this when using browserify+vue on my app.js:

"browserify": "browserify -t vueify browserify --ignore-missing --no-builtins --no-commondir --insert-global-vars=\"global\" --no-browser-field -e app.js -o resources/bundle.js --debug",

@angrykoala I had to add -x electron to my browserify command. I also needed to do the same for -x spellchecker if you're using that module too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

3rd-Eden picture 3rd-Eden  路  10Comments

ghost picture ghost  路  4Comments

ericmorand picture ericmorand  路  4Comments

jankuca picture jankuca  路  3Comments

timwis picture timwis  路  4Comments