-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(nextjs): Match loader files exactly #6013
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
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have to admit this feels a bit risky because of file path shenanigans (windows paths?). I am open to other suggestions.
Making it an exact match should be fine in combination with our query-string import approach because we don't want to process these files anyways. Maybe we can even remove the exit condition (
if (this.resourceQuery.includes('__sentry_wrapped__')) return userCode;
)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should have two regex - one for windows and one for Unix if this one does not support windows imo
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ugh, right, I always forget about windows path separators. Good call, @AbhiPrasad.
I don't think we need to do it in two regexes, though. We actually already know the pages directory, so I claim we can do this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah perfect, let’s do that then!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Katie that change gets rid of the solution for the
src
folder problematic: #5978I like however that we build the path to the Next.js
pages
before we pass it toescapeStringForRegex()
so I opted for a hybrid approach. 43f2823There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If their pages folder is in a
src
folder, that should be included inpagesDir
, no?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we shouldn't include both! It's either
pages
orsrc/pages
.Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I mean: If a user has their pages in
/pages
, then that will be reflected in the value ofpagesDir
. If a user has their pages insrc/pages
, that will also be reflected in the value ofpagesDir.
Either way, we don't need to recalculate the value.If I do
depending on whether or not I'm using a
src
directory I get eitheror
Update: Opened #6044 to remove the extra calculation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh sorry got confused and didn't realize that
pagesDir
was a thing. I'll approve that PR!