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

feat(nitro-utils): Export Rollup Plugin wrapServerEntryWithDynamicImport #14176

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

s1gr1d
Copy link
Member

@s1gr1d s1gr1d commented Nov 4, 2024

Creates an internal package @sentry-internal/nitro-utils which exports the Rollup plugin which is currently used in SolidStart and Nuxt.

return { id: source, moduleSideEffects: true, external: true };
}

if (options.isEntry && source.includes('.mjs') && !source.includes(`.mjs${SENTRY_WRAPPED_ENTRY}`)) {
Copy link
Member

Choose a reason for hiding this comment

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

I think this might not be strict enough. For example in SolidStart, the prerenderer would run through this too.

I'm not sure what the side effects are tho so I'm reluctant to change anything for the time being but maybe we can think about alternatives, e.g. making it configurable which sources should be caught in this. Maybe via a filter function or an array of entry files to be wrapped?

Comment on lines 22 to 26
serverConfigFileName: string;
resolvedServerConfigPath: string;
entrypointWrappedFunctions: string[];
additionalImports?: string[];
debug?: boolean;
Copy link
Member

Choose a reason for hiding this comment

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

m: Could we define an exported type for this instead of inlining it? In case the consuming sides need to expose these via their own options, it would be prone to running out of sync.

Copy link
Member

@Lms24 Lms24 left a comment

Choose a reason for hiding this comment

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

Just one question but otherwise good to go from my end! Full disclosure: I'm not completely familiar with the rollup plugin details but it looks fine from my perspective. I think the package is correctly configured to not be published or cause issues while publishing.

Comment on lines +7 to +11
# Sentry Utilities for Nitro-based SDKs

[![npm version](https://img.shields.io/npm/v/@sentry-internal/nitro-utils.svg)](https://www.npmjs.com/package/@sentry-internal/nitro-utils)
[![npm dm](https://img.shields.io/npm/dm/@sentry-internal/nitro-utils.svg)](https://www.npmjs.com/package/@sentry-internal/nitro-utils)
[![npm dt](https://img.shields.io/npm/dt/@sentry-internal/nitro-utils.svg)](https://www.npmjs.com/package/@sentry-internal/nitro-utils)
Copy link
Member

Choose a reason for hiding this comment

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

super-l: As long as we don't publish this package, these badges will yield a 404 but that's fine

Comment on lines 43 to 39
"@sentry/core": "8.36.0",
"@sentry/types": "8.36.0",
Copy link
Member

Choose a reason for hiding this comment

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

m: Does this package actually depend on core and types? I didn't see an import in the source files.

Comment on lines +3 to +4
export default makeNPMConfigVariants(
makeBaseNPMConfig({
Copy link
Member

Choose a reason for hiding this comment

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

l: Maybe one more question: Do we need a CJS version of this or is ESM enough? If we don't need CJS, we can configure the build to only emit ESM. In this case, we should also adjust the exports in package.json

Copy link
Member Author

Choose a reason for hiding this comment

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

ESM should be enough in Nitro 👍

@s1gr1d s1gr1d force-pushed the sig/nitro-utils branch 2 times, most recently from 3c908f4 to 73150d2 Compare November 7, 2024 12:38
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.

3 participants