Daan Luttik
Daan Luttik

Reputation: 2855

DialogFlow in frondend setting React

When I try to include the dialogflow SDK into my react app I get the following error.

The error

As I understand from what I've read this is because fs is a server-side module rather than a client-side module. But the documentation of the SDK imply that it is meant as a front-end SDK. So I hope we can get it to work.

Steps to reproduce

  1. run in console create-react-app reporduce_issue
  2. run in console npm install --save dialogflow
  3. add import {SessionsClient} from 'dialogflow' to App.js

I hope this can be solved.

Thanks!

Upvotes: 2

Views: 2641

Answers (1)

Daniel Situnayake
Daniel Situnayake

Reputation: 2904

For front-end work you'll want to use the Dialogflow JavaScript Web SDK, which is available here on GitHub:

https://github.com/dialogflow/dialogflow-javascript-client

You can install this via NPM using npm install [email protected].

The package you are currently installing is in fact the node.js client, available here:

https://github.com/dialogflow/dialogflow-nodejs-client-v2

Upvotes: 3

Related Questions