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

fix: injectQuery check with double slash in the url #14910

Merged
merged 2 commits into from
Nov 9, 2023

Conversation

patak-dev
Copy link
Member

Fixes #5051

Description

The currently used regex will fail if there is a double slash in the URL


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label Nov 8, 2023
str().overwrite(
start,
end,
`__vite__injectQuery(${url}, 'import')`,
`__vite__injectQuery(${rawUrl}, 'import')`,
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 think this should still work (as // comments should end up with a new line because they are wrapped in the import(...) call), and it is better to avoid removing the comments, for example in case other plugins are checking for @vite-ignore.

It is also interesting that @vite-ignore here can't be completely ignored, the import query needs to be injected dynamically even if it is used.

@patak-dev patak-dev merged commit 84c5ff6 into main Nov 9, 2023
15 checks passed
@patak-dev patak-dev deleted the fix/inject-query-check-with-double-slash branch November 9, 2023 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Dynamic (@vite-ignore'd) import with // breaks JS transform
2 participants