-
Notifications
You must be signed in to change notification settings - Fork 133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@orbit/record-cache with ESM not working #861
Comments
Can you provide a reproduction in a simple public project please? |
I've found out that the error is triggered only when running Vite dev server, it might be caused by the order of imported files. It works in Vite build though. I don't know if it's relevant for you anymore, if it is, here is the test project: https://github.com/Thomasan1999/orbit-record-cache-import-test. |
I'm getting this error on Vite too. I'm using Yarn 2 though, so I'm not sure if that's related to the error or not. |
@Thomasan1999 thanks for the test repo, I will investigate soon. I'm glad it seems to be working in Vite build. @tchak as a Vite user, do you have any ideas here? |
@dgeb Meanwhile, I've opened another issue in the Vite repo. According to sodatea, it might be related to circular dependencies. A similar issue here. @samwightt Apparently, if any package provides ESM build, you can exclude them from dependency pre-bundling.
|
@Thomasan1999 thanks for tracking this down. I can confirm that there is a circular dependency between |
I decided to remove the cycle in #868 because it cleaned up several aspects of the implementation (see the PR for details). This has been resolved in:
You can confirm that this fixes the vite/esbuild issue by changing the deps in your test repo to: - "@orbit/indexeddb": "0.17.0-beta.21",
- "@orbit/memory": "0.17.0-beta.21",
- "@orbit/records": "0.17.0-beta.21"
+ "@orbit/indexeddb": "0.17.0-beta.23",
+ "@orbit/memory": "0.17.0-beta.23",
+ "@orbit/records": "0.17.0-beta.22" Thanks again for your help tracking this down! |
I updated the deps in the test repo and in the project where I actually use them. It works in both now. |
When I try to import Orbit packages as ES modules, I get the following error:
record-transform-buffer.ts:33 Uncaught TypeError: Class extends value undefined is not a constructor or null
.It is related to the following line:
orbit/packages/@orbit/record-cache/src/record-transform-buffer.ts
Line 9 in fdb35dc
If I change the import path to
'.'
, it works.The text was updated successfully, but these errors were encountered: