vite icon indicating copy to clipboard operation
vite copied to clipboard

fix(plugin-legacy): force set `build.target`

Open sapphi-red opened this issue 3 years ago • 1 comments

Description

See https://github.com/vitejs/vite/pull/10052#issuecomment-1242076461 for reasons. I'm not sure whether this is a breaking change.

close #10052

Additional context


What is the purpose of this pull request?

  • [x] Bug fix
  • [ ] New Feature
  • [ ] Documentation update
  • [ ] Other

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

  • [x] Read the Contributing Guidelines.
  • [x] Read the Pull Request Guidelines and follow the Commit Convention.
  • [x] Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • [x] 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 avatar Sep 11 '22 13:09 sapphi-red

It is interesting that this wasn't found before, thanks for digging into it Sapphi. I think this PR is a good first step. We can release it as a minor for plugin-legacy to be on the safe side. In Vite 3.2 or maybe directly in Vite 4 I think it would be a good idea to decide if both targets should be same. I think it is a possibility that the best is the scheme after this PR, but in that case, we should better document how this work and why (for example because we want to avoid transpiling some features for a very small percentage of users if the target is modern browsers only)

patak-dev avatar Sep 11 '22 18:09 patak-dev

Oh looks like there are conflicts after I approved 😅

In Vite 3.2 or maybe directly in Vite 4 I think it would be a good idea to decide if both targets should be same.

I think we should keep them different for now. The modern build target could be changed by https://github.com/vitejs/vite/issues/6922 in the future, so I think the difference could be treated as a plugin-legacy feature.

bluwy avatar Sep 17 '22 16:09 bluwy

I think we should keep them different at least until Vite 4. I don't find any big benefits of doing this breaking change in Vite 3.x.

sapphi-red avatar Sep 18 '22 14:09 sapphi-red

Let's release this PR in a new minor for plugin-legacy tomorrow.

patak-dev avatar Sep 18 '22 14:09 patak-dev

Hope https://github.com/vitejs/vite/issues/2476 can be fixed to make build.target align with browserslist

kingyue737 avatar Sep 22 '22 12:09 kingyue737