Skip to content

fix(profiling-node): Only emit CJS and support ESM via import(cjs) #15150

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

Closed
wants to merge 3 commits into from

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Jan 23, 2025

Most bundlers don't support createRequire so they can't currently bundle @sentry/profiling-node.

To work around this, this PR changes @sentry/profiling-node to only output CJS. This works around the bundler issues by simply using require to load native modules which most (all?) bundlers support resolving.

We still continue to support ESM by including a single ESM file that re-exports the CJS code.

This PR adds a webpack test and updates the esbuild test to actually bundle the code.

@timfish
Copy link
Collaborator Author

timfish commented Jan 28, 2025

@timfish timfish closed this Jan 28, 2025
@timfish timfish deleted the timfish/fix/profiling-node-cjs branch February 12, 2025 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant