Skip to content

feat(nextjs): Parameterize prefix loader values #6377

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 6 commits into from
Dec 2, 2022

Conversation

lobsterkatie
Copy link
Member

This changes the prefixLoader we use in the nextjs SDK to accept template name and replacement values as parameters, and pulls injection of that loader into a helper function. It also renames the current template from prefixLoaderTemplate to serverRewriteFramesPrefixLoaderTemplate, to better indicate its purpose and to distinguish it from future templates also using the prefix loader.

@lobsterkatie lobsterkatie force-pushed the kmclb-nextjs-make-prefix-loader-generic branch from b2c314a to acef63c Compare December 1, 2022 23:41
@github-actions
Copy link
Contributor

github-actions bot commented Dec 1, 2022

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 19.57 KB (0%)
@sentry/browser - ES5 CDN Bundle (minified) 60.59 KB (0%)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 18.36 KB (+0.01% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 54.15 KB (0%)
@sentry/browser - Webpack (gzipped + minified) 20.12 KB (0%)
@sentry/browser - Webpack (minified) 65.75 KB (0%)
@sentry/react - Webpack (gzipped + minified) 20.14 KB (0%)
@sentry/nextjs Client - Webpack (gzipped + minified) 45.97 KB (0%)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 26.42 KB (+0.01% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 24.85 KB (+0.02% 🔺)
@sentry/replay index.js 37.08 KB (-0.33% 🔽)
@sentry/replay - Webpack (gzipped + minified) 37.06 KB (-0.32% 🔽)
@sentry/replay - Webpack (minified) 124.66 KB (-0.27% 🔽)

@lobsterkatie lobsterkatie requested a review from lforst December 2, 2022 05:25
Copy link
Contributor

@lforst lforst left a comment

Choose a reason for hiding this comment

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

I am kinda starting to wonder whether our prefixLoader isn't just a glorified DefinePlugin but we can worry about that in the future.

@lobsterkatie
Copy link
Member Author

I understand why you say that, but to be DefinePlugin, it'd need to be injecting values into code which already exists, which means we'd need to get users to include global.__rewriteFramesDistDir__ = '__DIST_DIR__'; in their sentry.server.config.js, which feels unlikely to work all that well.

@lobsterkatie lobsterkatie merged commit 1e78eb6 into master Dec 2, 2022
@lobsterkatie lobsterkatie deleted the kmclb-nextjs-make-prefix-loader-generic branch December 2, 2022 09:44
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