parcel-bundler / parcel

The zero configuration build tool for the web. 📦🚀
https://parceljs.org
MIT License
43.29k stars 2.25k forks source link

Parcel doesn't detect image changes from Windows explorer #8829

Open terrybrash opened 1 year ago

terrybrash commented 1 year ago

🐛 bug report

Parcel doesn't detect image changes made through Windows file explorer.

🎛 Configuration (.babelrc, package.json, cli command)

{
  "name": "parcel_problem",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "dev": "rimraf dist && parcel index.html --no-hmr --no-cache --log-level verbose"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "parcel": "^2.8.3",
    "rimraf": "^4.1.2"
  }
}

🤔 Expected Behavior

When an image is being imported by Parcel, it should notice changes made through the Windows explorer and update the dist cache.

😯 Current Behavior

https://www.youtube.com/watch?v=8_KVVdm8Sgo

💻 Code Sample

index.js used in the video above:

import hello from "/assets/hello.png";
const image = document.createElement("img");
image.src = hello;
document.body.appendChild(image);

🌍 Your Environment

Software Version(s)
Parcel 2.8.3
Node 18.10.0
npm/Yarn 8.19.1
Operating System Windows 10
terrybrash commented 1 year ago

Also, maybe somewhat related, Parcel doesn't detect changes to files when running git pull. Restarting the parcel dev server is always required.

devongovett commented 1 year ago

Anything weird about your setup? are you running off a network drive or anything?

terrybrash commented 1 year ago

Not that I can think of. Is this not reproducible on your end?

terrybrash commented 1 year ago

Running into a new, possibly related issue. Parcel will forever fail to resolve certain files after they've been modified.

@parcel/core: Failed to resolve '../assets/units.json' from './src/system.ts'

  C:\Users\Terry\ts\game\src\system.ts:1:20
  > 1 | import _units from "../assets/units.json";
  >   |                    ^^^^^^^^^^^^^^^^^^^^^^
    2 | import { AudioEvent, audioEventInit, audioPlay, Fonts, Sfx, SFX_EVENT, Sounds, TextureAtlasMap, Textures } from
    3 | import { BoundedArray } from "./bounded_array";

@parcel/resolver-default: Cannot load file '../assets/units.json' in './src'.
ℹ Did you mean '../assets/quaver.json'?
ℹ Did you mean '../assets/units'?                                                                                                                                       

"units.json" certainly exists, and repeatedly modifying the file doesn't fix the error.

Restarting Parcel does fix the error.

terrybrash commented 1 year ago

I should clarify, "units.json" is deleted and then created within a few hundred milliseconds, not modified. I do this as a workaround to the original issue posted above; Parcel fails to detect that the file was modified.

It seems I can work around this new problem by waiting a little over a second between deleting and creating the file.

github-actions[bot] commented 8 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.