sentry-javascript
sentry-javascript copied to clipboard
fix(remix): add esm export for node
We are running remix in ESM mode, but the exports in package.json is pointing to the CommonJS module, which results in the SDK running in CommonJS mode instead of ESM.
This lead to the instrumentations not running/detecting properly.
Thanks for the PR @topaxi, I have tested this locally, which caused the server/client trace-propagation to break on E2E tests. I'll try to check what caused that.
@topaxi, could you please check if the update here solves your issue?
@onurtemizkan no, this will still run the package in CommonJS mode.
What does work for me though, is to specify the default import. I have updated the PR :)
Sadly I'm not able to install the npm dependencies locally from this repository as yarn does not succeed and playwright install tries to call apt which I do not have on my machine.
Thanks for the update @topaxi. Yes, I can see that specifying default under import does not break the current tests. But to validate that it works on tests, could you tell which instrumentations were not detected properly?
This was specifically for express. The logs showed that express was not instrumented, and debug: true logged that sentry was running in CommonJS mode.
Switching sentry/remix to ESM fixed it (I assume previously, sentry instrumented only the CJS versions of the package(s), which aren't actually run in the application).
Thanks for the fix @topaxi!
This change broke our E2E tests so we'll likely revert.