DEV Community

Cover image for Making Desktop apps with Electron, React Native, and Expo

Making Desktop apps with Electron, React Native, and Expo

Evan Bacon on November 26, 2019

TL;DR: Example. Expo + Electron is in alpha (Nov 2019). docs = most recent info. This tutorial will show you how to use React Native, Electron, We...
Collapse
 
wernancheta profile image
Wern Ancheta • Edited

Thanks for writing this guide!
I tried creating a demo app with it and it works in development mode.

The only problem is that the build doesn't seem to work.
I'm getting this error when compiling in mac:

electron expo error

I used the following command to compile: yarn electron-webpack && yarn electron-builder --dir -c.compression=store -c.mac.identity=null

There were no errors in the compilation process. My babel.config.js looks like:

module.exports = function(api) {
  api.cache(true);
  return {
    presets: ['babel-preset-expo', 'module:metro-react-native-babel-preset', 'module:react-native-dotenv'], 
  };
};
Enter fullscreen mode Exit fullscreen mode

any ideas why this is? does babel-preset-expo support global module imports?

again, thank you for this. I'll continue trying to figure out what's wrong.

Collapse
 
aloaks profile image
Alberto Robles

Hi, there.

I'm getting a similar error. I've been trying to fix it by changing the syntax for that line from 'import from ...' to 'require('....')'.

It "worked" in the way that the error moved to the next "import" statement.
Is ES6 not working on the build?

Tried using other babel presets (babel/env, babel-react, etc...). With these ones, not even the building finishes.

Can't find any solution

Collapse
 
meedwire profile image
Leonardo Silva

Any answer on the subject, I have the same problem, a build example would be welcome.

Collapse
 
varmab profile image
Varma Bhupatiraju

@Wern, I have same issue. Did you find any solutions?

Collapse
 
comprider profile image
tsayyed

Any luck to create build for electron?

Collapse
 
evanbacon profile image
Evan Bacon

Wow that looks awesome! When you use Expo to make Electron apps you also get an iOS and Android app as well though.

Collapse
 
lfkwtz profile image
Michael Lefkowitz

Great post - I featured this on React Native Now newsletter #56

Collapse
 
evanbacon profile image
Evan Bacon

Awesome, thanks so much!

Collapse
 
nickytonline profile image
Nick Taylor

Great stuff. Thanks for sharing Evan. I've done a lot of React, but still haven't touched any of the native stuff, including Expo. Maybe I should start. 😎

 
longebane profile image
Long Dao

Yes it technically can, but simply isn't supported at all at the moment.

Collapse
 
kortbyoussama profile image
oussama benkortbi

really helpful post

i may need to figure out how can i resize the window and make use of electron

Collapse
 
seanmclem profile image
Seanmclem

Any way to run Expo app without having to download your JS bundle every time?

Collapse
 
arrygoo profile image
Aryan Goharzad

Yes,are you referring to during production or dev?

Collapse
 
arknoid profile image
Olivier Malige • Edited

Hello, I have problems with the implementation of Redux with this package...
Do you have any idea?

Thank you

Collapse
 
kibranoz profile image
Kibranoz

React Native desktop is available on Mac and Windows, but these aren't the only OS that exist on this planet. Some people use Linux