ref(nextjs): Add warning about non-hidden sourcemaps #5649
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds a warning during nextjs app build (both in prod and dev) letting folks know that by default (for now), the sourcemaps we create can be seen by browser devtools.
In conjunction with getsentry/sentry-wizard#188, getsentry/sentry-docs#5464, and vercel/next.js#40079, this is the first step in addressing the concerns raised in #4489. See here for more details.
Notes:
The function doing the warning includes both the current warning and one for use in v8 and beyond (currently commented out), telling people they no longer need to set
hideSourceMaps
totrue
(because by that point it will be the default).The formatting of the warning matches the formatting of other nextjs warnings. Because nextjs vendors
chalk
themselves, that meant we needed to add it as a dependency. Though the latest version ofchalk
is 5.x, here we're using 3.x because it's the last to be compatible with node 8. (See below for a screenshot.)There are
TODO
s reflecting the changes which need to be made in v8 (change the default totrue
, switch the warning message) and v9 or v10 (get rid of the second warning once it's had plenty of time to do its job).Screenshot of warning: