Failed to import 'motion/react'
Opened this issue · 2 comments
What version of Bun is running?
1.1.38+bf2f153f5
What platform is your computer?
Darwin 24.2.0 arm64 arm
What steps can reproduce the bug?
- bun i motion/react@12.0.0-alpha.2
- eval
import 'motion/react'
What is the expected behavior?
no error when import
What do you see instead?
SyntaxError: Export named 'createContext' not found in module 'XXXXXX/node_modules/motion/src/react.ts'.
Additional information
bun build is not working too
The issue seems to be because of the tsconfig.json
and its baseUrl
. It means bun checks it first on what to resolve (as there is react.ts
, bun thinks that is react)
https://github.com/motiondivision/motion/blob/main/packages/motion/tsconfig.json#L20
I'm not sure on the best solution to fix this but still support typescript in node_modules, but this is a decent node incompatibility that should be fixed (maybe only care about tsconfig for ts
files).
can you verify if this still occurs with
11.14.4
? As I believe the tsconfig.json is correctly excluded from the npm bundle now.
motiondivision/motion#2918
@codehz I believe the upstream issue is fixed now. I'm not sure whether Bun should change anything (or what to change) but I wouldn't be surprised if there are more issues from this tsconfig
issue.