Skip to content

perf(transformRequest): fast-path watch and sourcemap handling#16170

Merged
patak-cat merged 1 commit intomainfrom
perf-transform-request
Mar 17, 2024
Merged

perf(transformRequest): fast-path watch and sourcemap handling#16170
patak-cat merged 1 commit intomainfrom
perf-transform-request

Conversation

@bluwy
Copy link
Copy Markdown
Member

@bluwy bluwy commented Mar 15, 2024

Description

  1. Skip ensureWatchedFile if the file failed to load from the fs.
  2. Skip removing the sourcemap comment from files if we found there's no sourcemap early on.
  3. Improves sourcemap error message. (Users were having trouble with it in the past: Failed to load source map for /node_modules/.vite/vite.js #6981 and can't read sourcemap file #10172)

Additional context

I found these while trying to make this.load also work for files in the filesystem (#16018 (comment)), I needed to share some code from transformRequest.ts to pluginContainer.ts. But this PR applies to refactors first so it's easier to review.


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.

@bolt-new-by-stackblitz
Copy link
Copy Markdown

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

@bluwy bluwy added the p2-nice-to-have Not breaking anything but nice to have (priority) label Mar 15, 2024
@sapphi-red
Copy link
Copy Markdown
Member

I found these while trying to make this.load also work for files in the filesystem (#16018 (comment)), I needed to share some code from transformRequest.ts to pluginContainer.ts.

I thought about that while creating #14953, too. 🙂

@patak-cat
Copy link
Copy Markdown
Member

/ecosystem-ci run

@vite-ecosystem-ci
Copy link
Copy Markdown

@patak-cat patak-cat merged commit de60f1e into main Mar 17, 2024
@patak-cat patak-cat deleted the perf-transform-request branch March 17, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

p2-nice-to-have Not breaking anything but nice to have (priority)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants