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: omit protocol does not require pre-transform #15355

Conversation

XiSenao
Copy link
Collaborator

@XiSenao XiSenao commented Dec 15, 2023

Description

fix: #15335

Additional context

From a logical standpoint, it appears that at this stage, only JS requests or CSS requests are invoked with preTransformRequest, which is generally expected. However, when calling preTransformRequest from processNodeUrl, we may need to prevent the parsing of external JS or CSS request links. Therefore, this modification filters potential external links starting with //.


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines, especially the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Update the corresponding documentation if needed.
  • Ideally, include relevant tests that fail without this PR but pass with it.

Copy link

stackblitz bot commented Dec 15, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@XiSenao XiSenao force-pushed the fix/omit-protocol-does-not-require-pre-transform branch 2 times, most recently from 2ff3184 to 157e011 Compare December 15, 2023 07:22
@sapphi-red
Copy link
Member

sapphi-red commented Dec 15, 2023

Actually I think we should only call preTransformRequest for module script tag links instead. It seems we are calling it for classic script tag links and non-script tag links (e.g. img tags).

@XiSenao
Copy link
Collaborator Author

XiSenao commented Dec 15, 2023

From a logical standpoint, it appears that at this stage, only JS requests or CSS requests are invoked with preTransformRequest, which is generally expected. However, when calling preTransformRequest from processNodeUrl, we may need to prevent the parsing of external JS or CSS request links.

@sapphi-red
Copy link
Member

Ah, I missed the shouldPreTransform call.

@sapphi-red sapphi-red added p2-edge-case Bug, but has workaround or limited in scope (priority) regression The issue only appears after a new release labels Dec 15, 2023
Copy link
Member

@patak-dev patak-dev left a comment

Choose a reason for hiding this comment

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

Nice! Thanks for the fix

@patak-dev patak-dev merged commit d9ae1b2 into vitejs:main Dec 15, 2023
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p2-edge-case Bug, but has workaround or limited in scope (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug:Cannot load resources that start with //.
3 participants