atomiks / floating-ui

JavaScript positioning library for tooltips, popovers, dropdowns, and more

Home Page:https://floating-ui.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can't import the named export 'computePosition' from non EcmaScript module (only default export is available)

jessehanley opened this issue · comments

Hey there!

Huge fan of Tippy.js so jumped straight in here to see if we could get it to work with our product.

Installed it via yarn just fine, but running into when it compiles:
Can't import the named export 'computePosition' from non EcmaScript module (only default export is available)

I'm not so hot with React so was wondering what I'm missing?

Thanks!

This is caused by the dist module files being .mjs. See here for solutions: framer/motion#1307

I know that Nuxt 3 requires .mjs files to actually use a library.

I am thinking to prevent interop issues we can use .js files by default for "module" and Nuxt users can import the .mjs file directly...

If it's helpful, we're just a standard Rails app using Webpacker. Read through your link + dove into a few other issues and got a little lost so gave up (busy day today) 😅

Might try again laters.

This fix is now published on npm, it should just work™ now with any webpack-based bundler like CRA

You're awesome, thank you. Got it working and will continue to play. Having some issues getting it to align on a node in a draggable canvas but that's a "me" problem 🥴