naviapps / create-nw-react-app

Create NW.js React apps with no build configuration.
MIT License
144 stars 14 forks source link

Reload App is broken #31

Closed hoolymama closed 3 years ago

hoolymama commented 4 years ago

Hi there, Sometime in the last week something has broken in my app, even though my yarn.lock hasn't changed. Apologies if this turns out not to be a problem with create-nw-react-app.

When I choose Right mouse->Reload App, I get the following

TypeError: Cannot read property 'split' of undefined
isSchemeEqual
node_modules/sockjs-client/lib/utils/url.js:37
  34 |   return res;
  35 | },
  36 | isSchemeEqual: function (a, b) {
> 37 |   return a.split(':')[0] === b.split(':')[0];
  38 | },

sockjs-client is trying to compare this.url (from a SockJS instance) with loc.href which it gets by requiring "./location".

loc.href starts out as the URL of the chrome extension, (the value of global.location returned from "./location"), but on reload it is undefined. Maybe this is something to do with require("./location") running only once, and returning a location object that has since disappeared?

Just to be sure it wasn't caused by some recent change in my app, I created a fresh nw react app and the same error happens on Reload App.

I also created a clean nwjs app without create-nw-react-app and Reload App works fine.

Any insight into this would be much appreciated. I love this tool and would hate to have to go through the hassle of setting it up by hand.

Running Node 12.3.1 on a Mac, nw-react-scripts@2.1.1

Thanks!