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: import(/* @vite-ignore */) is not worked in *.ts for v4 (#11377) #11474

Closed
wants to merge 3 commits into from

Conversation

moushicheng
Copy link

@moushicheng moushicheng commented Dec 23, 2022

fix #11377

Description

Beacuse of a breaking change in esbuild 0.15.17 (evanw/esbuild#2439) , esbuild will remove comment /* @vite-ignore / in import(/ @vite-ignore */).

so i replace '/* @vite-ignore */' to 'vite__ignore' before transform and change back after transform to avoid this bug.

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.

@bluwy
Copy link
Member

bluwy commented Dec 28, 2022

This is a very smart trick, but it feels safer for me if we can fix this in esbuild instead. One issue with this trick is that it may mess with sourcemaps, especially if /* @vite-ignore */ is in a different line which causes things to be off-by-one.

@moushicheng
Copy link
Author

moushicheng commented Dec 29, 2022

This is a very smart trick, but it feels safer for me if we can fix this in esbuild instead. One issue with this trick is that it may mess with sourcemaps, especially if /* @vite-ignore */ is in a different line which causes things to be off-by-one.

Thank you for pointing out the mistake.
Indeed,It's better to fix esbuild .But I don't know much about esbuild source code,I will try to fix it.

aforondapax8
aforondapax8 previously approved these changes Dec 29, 2022
@bluwy
Copy link
Member

bluwy commented Jan 5, 2023

This is fixed in esbuild v0.16.14

@bluwy bluwy closed this Jan 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

import(/* @vite-ignore */) is not worked in *.ts for v4
3 participants