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

Can not support hmr x include files inside node_modules #304

Open
7 tasks done
Jinjiang opened this issue Apr 4, 2024 · 0 comments
Open
7 tasks done

Can not support hmr x include files inside node_modules #304

Jinjiang opened this issue Apr 4, 2024 · 0 comments
Labels
breaking change p2-nice-to-have 🍰 Not breaking anything but nice to have (priority)

Comments

@Jinjiang
Copy link

Jinjiang commented Apr 4, 2024

Describe the bug

When modifying files inside node_modules, the HMR doesn't work.

I guess it's because this line of code reject the following logics
https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/src/index.ts#L165

async transform(code, id, options) {
  if (id.includes('/node_modules/')) return
  ...
}

Maybe it could be simply combined with opt.include to let those files pass.

Thanks.

Reproduction

https://github.com/Jinjiang/reproductions/tree/vite-react-hmr-202404

Steps to reproduce

  • pnpm install and pnpm dev
  • modify node_modules/foo/index.mjs to see whether the page is reloaded

System Info

System:
    OS: macOS 14.4.1
    CPU: (8) arm64 Apple M1
    Memory: 79.17 MB / 8.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.11.1 - ~/.local/share/mise/installs/node/20/bin/node
    Yarn: 1.22.18 - ~/.yarn/bin/yarn
    npm: 10.2.4 - ~/.local/share/mise/installs/node/20/bin/npm
    pnpm: 8.15.5 - ~/Library/pnpm/pnpm
    bun: 1.0.29 - ~/.local/share/mise/installs/bun/latest/bin/bun
  Browsers:
    Safari: 17.4.1
  npmPackages:
    @vitejs/plugin-react: ^4.2.1 => 4.2.1 
    vite: ^5.2.8 => 5.2.8

Used Package Manager

pnpm

Logs

No response

Validations

@ArnaudBarre ArnaudBarre added p2-nice-to-have 🍰 Not breaking anything but nice to have (priority) and removed pending triage labels Apr 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change p2-nice-to-have 🍰 Not breaking anything but nice to have (priority)
Projects
None yet
Development

No branches or pull requests

2 participants