Skip to content

ref(profiling): Conditionally shim cjs globals #13267

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

Merged
merged 12 commits into from
Sep 10, 2024

Conversation

JonasBa
Copy link
Member

@JonasBa JonasBa commented Aug 7, 2024

The shims should only be applied if the globals are not present, else it results in double decl and a runtime error. The profiling SDK should gracefully handle env where the shims are already provided.

I couldn't find a way to modify the shim as it is hardcoded in the plugin we are using so I went with the replace plugin approach and a placeholder value #poormansmacros.

Fixes #13259

@JonasBa
Copy link
Member Author

JonasBa commented Aug 7, 2024

I need to add an e2e test before this can be merged

@lforst lforst changed the title ref(profiling) conditionally shim cjs globals ref(profiling): Conditionally shim cjs globals Aug 7, 2024
@JonasBa JonasBa requested a review from AbhiPrasad August 7, 2024 19:27
@JonasBa JonasBa force-pushed the jb/profiling/conditional-shim branch from 96bdbdf to f1f9bd4 Compare September 9, 2024 14:22
@JonasBa
Copy link
Member Author

JonasBa commented Sep 9, 2024

@AbhiPrasad mind taking another look, I added the check to run experimental modules and bumped to v22 of nodejs for profiling e2e tests

@@ -1168,7 +1168,7 @@ jobs:
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version-file: 'dev-packages/e2e-tests/package.json'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little hesitant about this because it means that CI runs differently than local - but I guess we can try this out, cc @mydea

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess it is OK - this is just for the e2e tests, we do not test if this works in node 18 then, not sure how important this is to us.

@AbhiPrasad AbhiPrasad merged commit 7fa366f into develop Sep 10, 2024
160 checks passed
@AbhiPrasad AbhiPrasad deleted the jb/profiling/conditional-shim branch September 10, 2024 09:05
@JonasBa
Copy link
Member Author

JonasBa commented Sep 10, 2024

Thanks for the reviews @AbhiPrasad @mydea!

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.

profiling-node should not shim cjs globals
3 participants