parcel: Only first change is tracked when index.html is not in the root dir

🐛 bug report

When running parcel and then changing source files a few times, the page is reloaded after the first edit only and no more reloads happen.

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

parcel src/index.html

{
  "name": "parcel-example1",
  "version": "1.0.0",
  "description": "example",
  "scripts": {
    "start": "parcel src/index.html"
  }
} 

🤔 Expected Behavior

Page reloads after each change.

😯 Current Behavior

Page reloads after first change only.

💁 Possible Solution

💻 Code Sample

src
  - index.html
  - main.js
package.json
<html>
  <head>
    <title>Parcel Example</title>
    <meta charset="UTF-8"/>
  </head>
  <body>
    <div id="calendar">Hello world!</div>
    <script src="main.js"></script>
  </body>
</html>

🌍 Your Environment

Software Version(s)
Parcel 1.9.7
Node 8.11.3
npm 6.2.0
Operating System Windows 10

About this issue

  • Original URL
  • State: open
  • Created 6 years ago
  • Reactions: 3
  • Comments: 18 (5 by maintainers)

Most upvoted comments

FYI, we’ve decided to build our own watcher for Parcel 2, and it should be much more reliable with safe write and other issues we’ve seen with chokidar. https://github.com/parcel-bundler/watcher

Fadora 28 parcel 1.10.3 - same problem reload works only first time for each file.

Here a repo: https://github.com/ManzDev/css-grid-cards

git clone and parcel serve src/index.pug and fail on checkout branches. Test on Windows 10 Pro N and Windows 10.

Fails on Parcel 1.9.6 Fails on Parcel 1.9.7 Down to Parcel 1.9.2 and works.

Ive looked a bit at other file system watchers and I think https://github.com/Axosoft/nsfw seems to be a good match to what parcel needs. Its used by VS Code among others, so it should be battle tested.

Edit: would a pull request for using nsfw be welcomed?

Im having a similar issue, where parcel is running inside a docker container (debian based, node v9, entrypoint = src/index.html) and only the first change to a file is registered by parcel. Any subsequent changes to a file can be seen in the docker container but the parcel file watcher seems to not care.

How come parcel needs its own home rolled file watcher? Please consider using a more battle tested solution.

We are stuck using parcel 1.9.2 at the moment.