Skip to content

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

Closed
timfish wants to merge 3 commits intodevelopfrom
timfish/fix/profiling-node-cjs
Closed

fix(profiling-node): Only emit CJS and support ESM via import(cjs)#15150
timfish wants to merge 3 commits intodevelopfrom
timfish/fix/profiling-node-cjs

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