[graphiql] not able to webpack @graphiql/react
under React 16/17 without loader workarounds
#3425
Closed
1 task done
Is there an existing issue for this?
Current Behavior
I'm trying to use webpack on a UI application which makes use of
@graphiql/react
and I see the following error:On closer inspection I notice that the distributed ES module
@graphiql/react/dist/index.mjs
includes the following (slightly obfuscated) line:In React 18's
package.json
there is an explicitexports
field which maps the importreact/jsx-runtime
directly toreact/jsx-runtime.js
, so this works. However, in React 17 or React 16 (which is what we're using), there is noexports
field, which means that (as this is an ES module) an explicit file extension is mandatory. Without it, module importing fails.Expected Behavior
I would expect a webpack build to work here.
Note that adding an explicit ".js" on the end of that import does fix the problem.
Steps To Reproduce
Add
src/index.js
:Then run:
Environment
react
Version: 16graphql
Version: 16.7.1Anything else?
A workaround is to set
in one's webpack configuration. However, I feel that this should just work out of the box instead of requiring this workaround.
The text was updated successfully, but these errors were encountered: