Skip to content

chore: show error position#13623

Merged
patak-cat merged 1 commit intovitejs:mainfrom
sapphi-red:chore/show-error-position
Jun 25, 2023
Merged

chore: show error position#13623
patak-cat merged 1 commit intovitejs:mainfrom
sapphi-red:chore/show-error-position

Conversation

@sapphi-red
Copy link
Copy Markdown
Member

Description

Follow up to #13608.

#13608 removed the second argument of this.error in some places. This is correct as this.error only receives the second argument in the transform hook.
That said, it would be better to pass the pos and other properties to give rollup more information to generate a friendly error.
This PR adds those information.

Additional context


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.
  • Read the Pull Request Guidelines and follow the PR Title Convention.
  • 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).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@sapphi-red sapphi-red added the p2-nice-to-have Not breaking anything but nice to have (priority) label Jun 25, 2023
@bolt-new-by-stackblitz
Copy link
Copy Markdown

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

Comment on lines -224 to +226
this.error(e)
this.error(e, e.idx)
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This this.error is in the transform hook. This was removed by mistake in #13608.

// using a class to make creating new contexts more efficient
class Context implements PluginContext {
meta = minimalContext.meta!
meta = minimalContext.meta
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This ! wasn't needed but added by #13608.

@patak-cat patak-cat merged commit 90271a6 into vitejs:main Jun 25, 2023
ailadas added a commit to ailadas/vite that referenced this pull request Jun 25, 2023
@sapphi-red sapphi-red deleted the chore/show-error-position branch June 26, 2023 02:31
xinxinhe1810 pushed a commit to xinxinhe1810/vite that referenced this pull request Jul 4, 2023
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.

2 participants