-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(sveltekit): Add import attribute for node exports #16528
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @eltigerchino thanks for fixing this! I started CI to ensure this change doesn't break on older SvelteKit versions.
In SvelteKit, we're now bundling dependencies on the server that specify SvelteKit as a dependency or peerDependency.
hmm so the Sentry SDK is not getting bundled? This will cause issues once we find an OpenTelemetry-compatible way of initializing the Server-side SDK (import-in-the-middle
cannot be bundled). I wonder if we'll need to work around this by removing the peer dependency on SvelteKit in some way. For now though, if this works, let's be pragmatic and merge this in.
(just assigning myself to the PR to indicate that I'm reviewing it)
The |
Ah sorry, I misstyped -- ignore the "not" in my previous reply 🤦♂️ (as in, I'm concerned about the SDK getting bundled instead of not bundled). However, if it'll only bundle
Yes:
I didn't merge this PR yet btw because for some reason, our SvelteKit<>Cloudflare e2e test app is failing with this change. Currently investigating what could be causing this. I suspect some kind of collision with the (sorry that this is taking so long, this day was really busy on our end) |
@eltigerchino I re-bumped the kit versions in this PR, since we first pinned them to 2.21.2 in #16529 to unblock our repo and debugged the failing cloudflare test a bit. It seems like, since we're now bundling More specifically, I can now find a chunk called
which we never import in runtime code but only our vite plugin code:
any idea how we can keep this out of the newly bundled way? I'm kinda getting NextJS flashbacks here, where all of a sudden our webpack plugin also ended up in runtime code causing this issue. Back then, we had to work around this with a dynamic import of the plugin which caused a million of other issues. Really hoping we could avoid this here 😅 |
Thank you!
I've added |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah nice, thanks for fixing the last test! CI seems to pass now. I just made a couple of cleanup changes but once everything is ready I'll merge it and see that we cut an SDK release today.
Thanks for fixing this -- really appreciate it!
This PR adds the external contributor to the CHANGELOG.md file, so that they are credited for their contribution. See #16528 Co-authored-by: Lms24 <[email protected]>
This PR changes the
node
export in thepackage.json
file to include animport
version (similar to the other exports) to fix sveltejs/kit#13869 . I'm not sure why theimport
key was left out but it seems to exist under the "module" key already, just that Vite never resolves to that one.In SvelteKit, we're now bundling dependencies on the server that specify SvelteKit as a dependency or peerDependency. This has caused an issue where builds with
@sentry/sveltekit
were being bundled incorrectly. Adding theimport
attribute fixes this so that Vite resolves to the ESM build of Sentry.yarn lint
) & (yarn test
).