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

feat: enable optimizeDeps.esbuildOptions.loader #6840

Merged
merged 3 commits into from
Apr 18, 2022

Conversation

dickeylth
Copy link
Contributor

@dickeylth dickeylth commented Feb 10, 2022

Description

Enable scan respect optimizeDeps.esbuildOptions.loader option so that the map of js types to loader could be customized, relevant issue: #3448

Additional context

I've read the relevant pr: #1884 and the suggested solution is "use an esbuild plugin to specify your own loaders", which I think it could be discussed because in that way the import.meta.glob logic would be missing in my own esbuild plugin. In my situation there are some internal ui library codes which have decorators in .jsx files and esbuild could only work by specify --loader:.jsx=tsx, since we have optimizeDeps.esbuildOptions in vite config I think it's acceptable to enable the build loader config to be recognized, otherwise maybe we should add loader into the omit list to avoid misleading option?


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 Commit 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.

@dickeylth dickeylth changed the title feat:scan enable optimizeDeps.esbuildOptions.loader feat: scan enable optimizeDeps.esbuildOptions.loader Feb 10, 2022
@dickeylth dickeylth changed the title feat: scan enable optimizeDeps.esbuildOptions.loader feat: enable optimizeDeps.esbuildOptions.loader Feb 11, 2022
@bluwy bluwy added the p2-to-be-discussed Enhancement under consideration (priority) label Mar 13, 2022
@bluwy bluwy linked an issue Mar 13, 2022 that may be closed by this pull request
4 tasks
@bluwy
Copy link
Member

bluwy commented Mar 13, 2022

Hi @dickeylth, I've put this in the team board to be discussed in the next meeting. Can't promise this would be talked on next though as we already had a lot in the list. Though it may be good to rebase too in the meantime. From a glance, the idea sounds fine to me.

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.

@dickeylth we discussed the PR in today's team meeting and we think it is a good addition.

There is a debug message that should be modified to reflect the used loader:

debug(
  `Unable to parse dependency: ${id}. Trying again with a JSX transform.`
)

Once the message is corrected, and conflicts solved we can merge it 👍🏼

@bluwy bluwy added p2-nice-to-have Not breaking anything but nice to have (priority) needs rebase and removed p2-to-be-discussed Enhancement under consideration (priority) labels Mar 27, 2022
enable respect `optimizeDeps.esbuildOptions.loader` option so that the map of js types to loader could be customized, relevant issue: vitejs#3448
bluwy
bluwy previously approved these changes Mar 30, 2022
@dickeylth
Copy link
Contributor Author

@bluwy @patak-dev It's been about 3 weeks, when will this pr be merged?

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

I've cleaned it up a bit, and merged up main. I think we forgot to merge this one in, but this lgtm to merge anytime.

@patak-dev patak-dev merged commit af8ca60 into vitejs:main Apr 18, 2022
@dickeylth dickeylth deleted the patch-1 branch June 22, 2022 07:19
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
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants