Skip to content

feat(build): Core packages into single output files #11030

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 3 commits into from
Mar 12, 2024

Conversation

timfish
Copy link
Collaborator

@timfish timfish commented Mar 11, 2024

Ref #7859

Before making the changes in this PR, the following code:

console.time('import sdk');
const pkg = await import('@sentry/nextjs');
console.assert(pkg != undefined);
console.timeEnd('import sdk');

Outputs around 75ms with node v18.17.0.

After the changes in this PR, the time came down to around 55ms, so around a 30% improvement for Node.js loading.

I suspect there will be greater improvements for bundlers but I've not tested that yet.

@timfish
Copy link
Collaborator Author

timfish commented Mar 11, 2024

It's worth noting that once nextjs migrates to the otel node package, this is likely to regress significantly.

Even when bundled to a single file, the otel node SDK on its own takes ~125ms to import. This is in comparison to ~40ms for the old Node SDK.

Without looking into this too much, I guess it's all the otel imports and perhaps even some side effects they introduce?

@timfish timfish marked this pull request as ready for review March 11, 2024 18:55
@AbhiPrasad
Copy link
Member

Even when bundled to a single file, the otel node SDK on its own takes ~125ms to import. This is in comparison to ~40ms for the old Node SDK.

This matches my personal testing, it increasingly seems like we have to contribute upstream to help improve situation there.

Copy link
Member

@AbhiPrasad AbhiPrasad left a comment

Choose a reason for hiding this comment

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

I guess this has an adverse affect on bundle analyzer tools right? Harder to tell via the visualizations what is problematic.

@timfish
Copy link
Collaborator Author

timfish commented Mar 12, 2024

I guess this has an adverse affect on bundle analyzer tools right?

Yep, I guess you'll only see module level detail

@AbhiPrasad AbhiPrasad merged commit 140f017 into develop Mar 12, 2024
@AbhiPrasad AbhiPrasad deleted the timfish/output-core-packages-into-single-file branch March 12, 2024 13:13
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.

2 participants