TS warning that headlessui/react resolves to an ES module and must be dynamically imported
See original GitHub issueWhat package within Headless UI are you using?
What version of that package are you using?
v1.6.6
What browser are you using?
Firefox
Reproduction URL https://github.com/maplesyrupman/wacky-imports
Describe your issue
When I import { Dialog, Transition } from "@headlessui/react";
, I get the following error:
Module '@headlessui/react' cannot be imported using this construct. The specifier only resolves to an ES module, which cannot be imported synchronously. Use dynamic import instead.ts(1471)
However, things seem to be working fine… not sure if this is really a headlessui bug or just a typescript issue.
Issue Analytics
- State:
- Created a year ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Error when trying to use dynamic import with module: "es2015"
I get error Dynamic import cannot be used when targeting ECMAScript 2015 modules. ... es modules but it doesn't make sense because import()...
Read more >How to Bypass ES Modules Errors in Next.js with Dynamic ...
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /path/to/package require() of ES modules is not supported. ES module file as it ...
Read more >Using React within a dynamically loaded es module
So my dist file contains import React from 'react'; for which the browser has no idea how to resolve, and produces: (index):1 Uncaught...
Read more >expected the result of a dynamic import() call. instead received
React.lazy takes a function that must call a dynamic import() . This must return a Promise which resolves to a module with a...
Read more >React, JSX, ES module imports (dynamic too) in browser ...
Package specifier imports support (or import maps): when we import react in reality we should import something like https://cdn.com/react/react.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Ah so I missed that we may have run into this before @maplesyrupman: https://github.com/tailwindlabs/headlessui/issues/1699#issuecomment-1196923579
This should have been fixed in the latest insiders release which you can install with this:
npm install @headlessui/react@insiders
@thecrypticace Awesome, thanks dude