Quantcast
Channel: GoJS - Northwoods Software
Viewing all articles
Browse latest Browse all 7069

GoJS Import Undefined in electron create-react-app

$
0
0

@rapo_mit wrote:

I am using GoJS v2.0.2 in an electron app that is built using webpack via create-react-app and coded in typescript. When I import gojs:

import * as go from ‘gojs’

I can see in the chrome debugger that the module is loaded but the exports object is undefined.

After looking closely at the release/go.js module logic, it seems that the issue may be in the line:

'undefined' !== typeof module && 'object' === typeof module.exports && (module.exports = 'undefined' !== typeof global ? global.go : self.go);

At this point, neither global.go nor self.go have been set and are both undefined, so module.exports is set to undefined.

If I first define global.go by adding this line, the export works and all is good:

if ("undefined" !== typeof global) global.go = Ht;

I have also tried the module version of the library, but the export is still undefined.

So, I can get it to work by adding a line but would prefer to use an unmodified library. I’m not a js module expert so any help will be appreciated. I can share a repo if that helps.

Thanks.

Andrew

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 7069

Trending Articles