nandorojo / moti

🐼 The React Native (+ Web) animation library, powered by Reanimated 3.
https://moti.fyi
MIT License
3.9k stars 120 forks source link

Vite Compat! #339

Open natew opened 2 months ago

natew commented 2 months ago

Is there an existing issue for this?

Do you want this issue prioritized?

Current Behavior

Importing moti via Vite results in some errors, usually in the form of it expecting cjs but getting esm:

/takeout/test/node_modules/@tamagui/animations-moti/node_modules/moti/author/index.js:1 export * from '../build/author'

Expected Behavior

Should work with Vite / esm

Steps To Reproduce

I think you can try the Tamagui starter:

npm create tamagui@latest --template=simple-web

And then add moti and run dev:vite

Versions

- Moti: latest!
- Reanimated:
- React Native:

Screenshots

No response

Reproduction

I promise I'll get a better one soon :)

nandorojo commented 2 months ago

Does vite have any sort of transpiling the way that next.js has transpilePackages?

nandorojo commented 2 months ago

Moti uses expo-modules build so presumably any expo module will run into the same issue.