Closed mcrawford closed 10 months ago
That's an optional import that performs different functionality at runtime upon failure, so the fact that webpack is trying to load it when it can't is incorrect. I think you're supposed to use the IgnorePlugin
to stop webpack from trying that? Not sure though
It seems like next.js v13.1.5 is supposed to support this out of the box as well https://github.com/webpack/webpack/issues/13290#issuecomment-1188760779
I did see that issue and the Next.js comment, but I was already using Next 13.4.7 so I didn't think that was the problem.
I'll try to check out the webpack IgnorePlugin
but it doesn't look real straightforward to me at first glance.
Any resolution to this problem?
I ran into the same issue using next:13.4.13
, axios:^1.4.0
, and scryfall-sdk:^4.1.1
Module build failed: UnhandledSchemeError: Reading from "node:events" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
Import trace for requested module:
node:events
./node_modules/scryfall-sdk/out/util/EventEmitter.js
./node_modules/scryfall-sdk/out/util/MagicEmitter.js
./node_modules/scryfall-sdk/out/api/Cards.js
./node_modules/scryfall-sdk/out/Scry.js
I'm getting the following error when I installed and tried to use the latest version 4.1.1:
Module build failed: UnhandledSchemeError: Reading from "node:events" is not handled by plugins (Unhandled scheme). Webpack supports "data:" and "file:" URIs by default. You may need an additional plugin to handle "node:" URIs. Import trace for requested module: node:events ./node_modules/scryfall-sdk/out/util/EventEmitter.js ./node_modules/scryfall-sdk/out/util/MagicEmitter.js ./node_modules/scryfall-sdk/out/api/Cards.js ./node_modules/scryfall-sdk/out/Scry.js
I am using it in a Next.js project, v13, and using Node 18.
Then I tried installing version 3.3.0 and the error went away and everything seems to work fine. So I'm guessing it's something to do with switching from axios to fetch.
I have tried changing Node versions and tried adding axios explicitly but none of that seems to work with version 4.