ky-universal | Use Ky in both Node.js and browsers | HTTP library
kandi X-RAY | ky-universal Summary
kandi X-RAY | ky-universal Summary
Use Ky in both Node.js and browsers
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of ky-universal
ky-universal Key Features
ky-universal Examples and Code Snippets
Community Discussions
Trending Discussions on ky-universal
QUESTION
I came upon this error when trying to use ky
in a Next.js project:
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /foo/node_modules/ky/index.js
I think the problem is that Webpack (or Babel) is transforming all import
s to require()
s but ky
is a pure ES module.
I got it working by dynamically importing ky
before using it but it's not elegant nor efficient.
ANSWER
Answered 2021-Feb-01 at 09:30Since ky
is exported as ESM you can transpile it with next-transpile-modules
in next.config.js
.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install ky-universal
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page