FBP Graph library with React: error on require()

35 views
Skip to first unread message

Santosh Kumar

unread,
Oct 18, 2017, 8:15:59 AM10/18/17
to Flow Based Programming
I am trying to create a web-based FBP frontend based on noflo.  To start with I want to integrate FBP Graph Library with a React app. I am using web-pack for the app. I am basically a C++ programmer who has recently taken to Javascript and React. 

In my react component on import using following code:

var fbpGraph = require('fbp-graph');

I get the error:
ERROR in ./node_modules/fbp-graph/lib/Graph.js Module not found: Error: Can't resolve 'fs'

I am able to solve this issue using:

node: {
fs: 'empty'
},

in webpack.config.js.

My worry is:

Why does FBP Graph Library needs a file system and what will happen if I run it  in the browser with this setting? 

Any help will be very useful to me. Thank you all.

Santosh

Jon Nordby

unread,
Oct 18, 2017, 1:30:38 PM10/18/17
to Flow Based Programming
Hi Santosh,

There is *optional* support for saving a graph to disk in fbp-graph. But because the way webpack scans for dependencies it can't really know that this codepath will never be executed in a browser context.

Santosh Kumar

unread,
Oct 18, 2017, 3:04:16 PM10/18/17
to flow-based-...@googlegroups.com
Hi Jon,

Thanks a lot. It was very helpful.

Regards,
Santosh

On Wed, Oct 18, 2017 at 11:00 PM, Jon Nordby <nordb...@gmail.com> wrote:
Hi Santosh,

There is *optional* support for saving a graph to disk in fbp-graph. But because the way webpack scans for dependencies it can't really know that this codepath will never be executed in a browser context.

--
You received this message because you are subscribed to a topic in the Google Groups "Flow Based Programming" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/flow-based-programming/KWW8w-qt5LU/unsubscribe.
To unsubscribe from this group and all its topics, send an email to flow-based-programming+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages