-
Notifications
You must be signed in to change notification settings - Fork 2k
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
[Bug]: Not working in Astro #1817
Comments
Thanks so much for the reproduction! I think this is something to do with the default export in the eventemitter3 library, see bug reported here. There doesn't seem to be a clear resolution for that, so I'll just switch to a named export and that should solve the issue. |
This PR switches from the default export to a named export in event emitter 3. Should close #1817. ### Change Type - [x] `patch` — Bug fix ### Test Plan 1. Hard to test ahead of time, but try [this reproduction](https://stackblitz.com/edit/github-6vmn42?file=src%2FEditor.jsx,src%2Fpages%2Findex.astro,package.json&on=stackblitz) with the new version. ### Release Notes - [@tldraw/editor] updates eventemitter3 import to fix issue with Astro builds.
Thanks a lot!!! Any ETA on release? Wanna test out tldraw as soon as possible 😁 |
I dont think this resolved the issue; the error message im getting now is...
It looks like you have to consume the package this way, or you can bump the version of the eventemitter3 package to the latest version. We are on v4, and v5 adds support for esm (https://github.com/primus/eventemitter3/releases/tag/5.0.0). After fixing this inplace within node_modules, I run into the same issue with the package "lz-string". Upon fixing this packages usage also, I finally started loading assets for the editor, but now its stuck "Loading assets...". I may be able to take a closer look later and maybe open a pr |
Also seeing this error in context of Remix as a Vite plugin. Can't circumvent (e.g. |
So the following patches fix the tldraw build in a Remix app for me:
|
This PR changes our imports so that they work in a few rare cases. #1817 ### Change Type - [x] `sdk` — Changes the tldraw SDK - [x] `bugfix` — Bug fix ### Release Notes - Fix bug effecting imports in Astro.
What happened?
First of all, freaking AWESOME library man!!! 🔥🔥🔥
I tried to use
@tldraw/editor
in Astro based environment, but I keep getting bundler errors. Now, I think it's not Astro itself, but some vite config at some level.I keep getting the error:
[vite] Error when evaluating SSR module /src/Editor.jsx: failed to import "@tldraw/editor"|- file:///home/projects/github-6vmn42/node_modules/@tldraw/editor/dist/esm/lib/app/App.mjs:35import { EventEmitter } from "eventemitter3"; ^^^^^^^^^^^^SyntaxError: The requested module 'eventemitter3' does not provide an export named 'EventEmitter'
How can we reproduce the bug?
https://stackblitz.com/edit/github-6vmn42?file=src/Editor.jsx,src/pages/index.astro,package.json&on=stackblitz
What browsers are you seeing the problem on?
Chrome
Contact Details
twitter @puruvjdev
Code of Conduct
The text was updated successfully, but these errors were encountered: