fair-rose
fair-rose2y ago

Cannot use import statement outside a module

Getting the following error using the voiceflow/react-chat library:
/Users/user/dev/site/fe/node_modules/@voiceflow/react-chat/build/index.es.js:1
import * as Fe from "react";
/Users/user/dev/site/fe/node_modules/@voiceflow/react-chat/build/index.es.js:1
import * as Fe from "react";
7 Replies
fair-rose
fair-roseOP2y ago
Extremely basic chat component in my frontend https://pastebin.com/j92Ld1j3 @Tico | Voiceflow Assistant any advice? @W. Williams (SFT) Is it OK if I tag you like this? managed to get the components working like so:
const Launcher = dynamic(
() => import("@voiceflow/react-chat").then((mod) => mod.Launcher),
{
ssr: false,
},
);
const Launcher = dynamic(
() => import("@voiceflow/react-chat").then((mod) => mod.Launcher),
{
ssr: false,
},
);
but not for useRuntime Cannot use import statement outside a module if trying to require() or import it otherwise I get "useRuntime is not a function" if trying to import dynamically
W. Williams (SFT)
I'm not gonna lie, I haven't look at the react-chat in forever. Let's see if @MikeG knows.
MikeG
MikeG2y ago
Ye the following
No description
MikeG
MikeG2y ago
d15bb6d1c44ccaa3d4d743bbae02d2675a03146a
d15bb6d1c44ccaa3d4d743bbae02d2675a03146a
@Deleted User
fair-rose
fair-roseOP2y ago
OK thanks Ill try that Do you hav a version number? I'm installing it as an NPM package in a nextjs repo
MikeG
MikeG2y ago
no clue unfortunately, I set it up before all this happened
fair-rose
fair-roseOP2y ago
Ill wait for alex' reply @SuperZooper just trying to use this as a package in a nextjs app and getting some errors anyone?

Did you find this page helpful?