shadow cljs jsx file - react index default is undefined

23 views
Skip to first unread message

Scott Klarenbach

unread,
Apr 25, 2020, 1:57:59 PM4/25/20
to ClojureScript
I'm following the instructions from here: https://shadow-cljs.github.io/docs/UsersGuide.html#_javascript_dialects to get jsx flies compiled through babble and required in clojurescript, but I keep getting the error: react index default is undefined

Is this an npm/react issue?  I only have one react installed for the project.

thanks
scott klarenbach

Thomas Heller

unread,
Apr 26, 2020, 6:07:05 AM4/26/20
to ClojureScript
I'm assuming you are trying a .js file that has

   import React from "react";

This would try to access the default export of react. Since react only ships CommonJS it has no default export. CommonJS and ESM interop is in a weird spot currently and a bit ugly.

  import * as React from "react";

This should be fine.
Reply all
Reply to author
Forward
0 new messages