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

refactor: Silence Rollup warnings regarding source maps & use directives #150

Merged
merged 1 commit into from
Jan 1, 2025

Conversation

rschristian
Copy link
Member

Someone mentioned this in Slack the other day. It appears as though any use of the 'use client' directive w/ sourcemaps enabled will trigger this warning, and do so per file -- react query & MUI (apparently) result in a lot of terminal spam as such.

Reference:

Comment on lines -156 to +160
// Silence Rollup's module-level directive warnings -- they're likely
// to all come from `node_modules` (RSCs) and won't be actionable.
if (warning.code === "MODULE_LEVEL_DIRECTIVE") return;
// Silence Rollup's module-level directive warnings re:"use client".
// They're likely to come from `node_modules` and won't be actionable.
if (
warning.code === "MODULE_LEVEL_DIRECTIVE" &&
warning.message.includes("use client")
Copy link
Member Author

Choose a reason for hiding this comment

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

I figure copying Vite's React plugin and restricting this to only use client is a good idea -- users should be warned if a use server shows up somewhere.

@rschristian rschristian merged commit d12a511 into main Jan 1, 2025
1 check passed
@rschristian rschristian deleted the refactor/silence-rsc-sourcemap-warnings branch January 1, 2025 00:12
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