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: support including files in node_modules #306

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Jinjiang
Copy link

@Jinjiang Jinjiang commented Apr 8, 2024

Description

User can't customize exclude option to support hmr for files inside node_modules.

Additional context

#304

With this PR, the reproduction can be fixed by Vite config:

plugins: [react({
  include: [/\.[tj]sx?$/, /\.[mc]js$/],
  exclude: [/\/node_modules\/(?!foo\/)/],
})],

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.

Copy link
Member

@ArnaudBarre ArnaudBarre left a comment

Choose a reason for hiding this comment

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

This is good because it doesn't increase the number options, but this makes it a breaking change for people using the exclude option.

I've discussed with other team members and for now the consensus is to not add more option just this uncommon use case, so I'll wait for next major of the plugin, which will probably be at the same moment as Vite 6 end of May but could be sooner if there is a need like supporting React 19 or a new meta framework

packages/plugin-react/src/index.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants