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

after vite3.0 not listening for changes to the JSON file #9521

Closed
7 tasks done
Hzzy2O opened this issue Aug 4, 2022 · 2 comments · Fixed by #9610
Closed
7 tasks done

after vite3.0 not listening for changes to the JSON file #9521

Hzzy2O opened this issue Aug 4, 2022 · 2 comments · Fixed by #9610
Labels
feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release

Comments

@Hzzy2O
Copy link

Hzzy2O commented Aug 4, 2022

Describe the bug

Is it canceled the monitoring of the json file? or need some config

2.9.14 and the previous version no problem

Reproduction

https://stackblitz.com/edit/vitejs-vite-renxka?file=tst.json,package.json,main.js,demo.js,tst.js&terminal=dev

System Info

System:
    OS: Windows 10 10.0.19044
    CPU: (8) x64 Intel(R) Core(TM) i7-9700 CPU @ 3.00GHz
    Memory: 1.32 GB / 15.87 GB
  Binaries:
    Node: 16.13.2 - C:\Program Files\nodejs\node.EXE
    Yarn: 1.22.19 - C:\Program Files\nodejs\yarn.CMD
    npm: 8.1.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Spartan (44.19041.1266.0), Chromium (103.0.1264.77)
    Internet Explorer: 11.0.19041.1566

Used Package Manager

pnpm

Logs

No response

Validations

@ryanmcbrideusf
Copy link

I noticed the same problem in my own project.

From my testing, versions 3.0.0-beta.6 and higher are broken (including the latest release, 3.0.4): if I modify a JSON file, code that depends on it will not reload.
Version 3.0.0-beta.5 and lower do work: if I modify a JSON file, code that depends on it will reload as expected.

Hopefully this helps the Vite devs.

@ChrisTowles
Copy link

In vite@^3.0.0 you can specify a importing-asset parameter.

import json from './tst.json?init'; // makes it hot reloadable

or

import json from './tst.json?inline'; // makes it hot reloadable

Reproduction: on StackBlitz ⚡️

Not sure which is better but both work.

Best documentation I could find was https://vitejs.dev/guide/assets.html#importing-asset-as-url but that wasn't clear nor did it list inline or init.

@sapphi-red sapphi-red added feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority) labels Aug 5, 2022
@sapphi-red sapphi-red added the regression The issue only appears after a new release label Aug 10, 2022
patak-dev pushed a commit that referenced this issue Aug 10, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Aug 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feat: hmr p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants