Skip to content
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

[cli] add compile cache to improve startup performance #12783

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

styfle
Copy link
Member

@styfle styfle commented Dec 19, 2024

Copy link

changeset-bot bot commented Dec 19, 2024

🦋 Changeset detected

Latest commit: 07d680d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
vercel Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

"use strict";
// This shim defers loading the real module until the compile cache is enabled.
// https://nodejs.org/api/module.html#moduleenablecompilecachecachedir
try {
Copy link
Member

Choose a reason for hiding this comment

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

The try/catch is to make this a no-op on Node < 22?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct


writeFileSync(
new URL('vc.js', distRoot),
`#!/usr/bin/env node
Copy link
Member

Choose a reason for hiding this comment

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

Any reason in particular why this is defined inline? How about we move it to a separate file which gets copied to dist?

Copy link
Member Author

@styfle styfle Dec 19, 2024

Choose a reason for hiding this comment

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

I was going to do that but the code was small and unlikely to change.

We also write a file here so its not unprecedented:

function createConstants() {
const filename = new URL('src/util/constants.ts', repoRoot);
const contents = `// This file is auto-generated
export const SENTRY_DSN: string | undefined = ${envToString('SENTRY_DSN')};
`;
writeFileSync(filename, contents, 'utf8');
}

If you feel strongly I can move it to a separate file. I'm just not sure which directory it should live in.

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