Parcel: Parcel won't stop rebuilding in dev mode

Created on 31 Aug 2019  ยท  21Comments  ยท  Source: parcel-bundler/parcel

๐Ÿ› bug report

Running parcel in "dev mode" on OS X just constantly rebuilds which triggers reloads making it impossible to work with :(

๐ŸŽ› Configuration (.babelrc, package.json, cli command)

package.json

{
  "name": "ozzie",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "start": "parcel ./index.html",
    "test": "mocha --timeout=10000",
    "dbemulator": "firebase serve --only firestore"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "antd": "^3.20.1",
    "dotenv": "^8.0.0",
    "firebase": "^6.3.0",
    "firebase-init": "^1.3.2",
    "formik": "^1.5.8",
    "moment": "^2.24.0",
    "query-string": "^6.8.2",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-redux": "^7.1.0",
    "react-redux-firebase": "^3.0.0-alpha.13",
    "react-router-dom": "^5.0.1",
    "recompose": "^0.30.0",
    "redux": "^4.0.4",
    "redux-firestore": "^0.8.0"
  },
  "devDependencies": {
    "@babel/core": "^7.5.5",
    "@babel/plugin-proposal-class-properties": "^7.5.5",
    "@babel/plugin-transform-runtime": "^7.5.5",
    "@babel/preset-env": "^7.5.5",
    "@babel/preset-react": "^7.0.0",
    "@babel/runtime": "^7.5.5",
    "babel-loader": "^8.0.6",
    "babel-polyfill": "^6.26.0",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "parcel-bundler": "^1.12.3",
    "@firebase/testing": "0.10.0",
    "filesystem": "1.0.1",
    "mocha": "5.2.0",
    "should": "^13.2.3"
  }
}

.babelrc

{
  "presets": [
    [
      "@babel/preset-env",
      {
        "targets": {
          "browsers": [
            ">0.25%",
            "not ie 11",
            "not op_mini all"
          ]
        }
      }
    ],
    "@babel/preset-react"
  ],
  "plugins": [
    "@babel/plugin-transform-runtime",
    "@babel/plugin-proposal-class-properties"
  ]
}

๐Ÿค” Expected Behavior

It should only rebuild and reload when I save a file.

๐Ÿ˜ฏ Current Behavior

Constantly rebuilding and causing refreshing. The gif below you can see. I'm doing absolutely nothing but sitting and watching my terminal.

rebuild

๐Ÿ’ Possible Solution

Maybe not a solution per se but it'd be nice to get some info on _what_ is causing this refresh. Something is triggering a "change" event, but what?

๐Ÿ”ฆ Context

Just a brain dump but I'm working in IntelliJ. I tried IntelliJ's terminal and iTerm. I've tried deleting node_modules, dist, .cache, and package-lock. I've reinstalled npm modules multiple times.

๐Ÿ’ป Code Sample

I can't publicly share the code but it's a _pretty_ simple React app that uses Firebase and Firestore.

๐ŸŒ Your Environment

| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | 1.12.3
| Node | 10.16.0
| npm/Yarn | 6.9.0
| Operating System | Mac OS 10.14.1 (18B75)

Bug

Most helpful comment

I create a new example from scratch on my system and now works perfectly.

I have been working fine with no problems for a while.
Sometimes, when write an import to a .js file and save, infinite looping has started.

  • If I break (CTLR-C) and restart Parcel, it continues loop.
  • If I delete the .parcel-cache folder and restart Parcel, works correctly again.

All 21 comments

I'm wondering if this has to do with having it inside of a Dropbox directory. I think Dropbox might be creating temp files or touching files when it sees changes. Is there a way to whitelist or blacklist files?

@OscarGodson issues with dropbox has been reported in the past probably good to move it out of dropbox

Sent with GitHawk

Had the same issue today on OSX.

I was able to fix it by moving my project into a directory that is not synced with iCloud Drive.

Having the same issue here, Parcel continuously restarting whenever Dropbox enters sync mode
Did anyone find a fix or a workaround?

@liorgrossman it has to do with the watcher detecting file changes made by dropbox... the only workaround is to not have a parcel project in a dropbox folder. Maybe we could eventually debug this and potentially improve our watcher to handle this properly although I doubt we can differentiate it from legitimate updates.

I have this issue and I am not using dropbox.
For me, it happened when I switched branches while parcel was running.
Even after switch complete, the issue still happens

When i ctrl c i get:
@parcel/reporter-dev-server: Could not send success event to devserver because it does not exist.

@bobbwhy that sounds like a different issue, feel free to open a new issue

Same error with a simple html with link to empty CSS/JS files.

parcel: 2.0.0-beta.1 (and 2.0.0-nightly.432 fails too)
node: 14.14.0 with npm 7
so: Debian 10 with WSL

parcel-error

@ManzDev are you running it inside a dropbox or some other kind of cloud storage synced folder?

@ManzDev are you running it inside a dropbox or some other kind of cloud storage synced folder?

No, Parcel 1 works fine, but Parcel 2 build constantly. I'm running under WSL (Debian 10). No dropbox.

@ManzDev strange, can you create a minimal reproduction?

Hi @DeMoorJasper

I created this minimal reproduction and works fine (also with node 14.14.0). But in my system, ocurrs infinite rebuilding.

FROM node:12.19.0-slim
WORKDIR /app
RUN npm init -y && \
    npm install --save-dev parcel@next
RUN mkdir -p src/css src/js
RUN touch src/css/index.css && touch src/js/index.js
COPY index.html /app/src
CMD ["npx", "parcel", "src/index.html"]

I create a new example from scratch on my system and now works perfectly.

I have been working fine with no problems for a while.
Sometimes, when write an import to a .js file and save, infinite looping has started.

  • If I break (CTLR-C) and restart Parcel, it continues loop.
  • If I delete the .parcel-cache folder and restart Parcel, works correctly again.

@ManzDev that definitely sounds like some kind of recursion bug, but kind of need a way to reproduce it to debug it properly.

This probably occurred sometime in the past and you still had a cache entry for it which caused it to happen consistently for you but works fine with a new project. I assume the only thing you can do is if it ever happens again to think what you changed before and try and create a reproduction based on that change. I really wished I could help more here as this does sound like a pretty severe bug.

I need to test a bit more to see if it happens with some kind of specific pattern. It seems like it doesn't always happens.

I would also like to try on another system. As soon as I know more, I'll post it here. Thank you very much!

I had the same issue on MacOS (Catalina 10.15.7, Node 14.14.0, Parcel 2.0.0-nightly.440).

Like @ManzDev, deleting the .parcel-cache folder stopped the constant build process (thanks for that tip!), but I noticed it started happening again after I got a build error. I have reproduced it in this way roughly six times, though I have not tried in other projects.

parcelBug

This consistently reproduces it for me:

$ yarn add --dev [email protected]
$ touch a.html
$ echo '<a href="a.html">' > b.html
$ ( sleep 3s && touch a.html ) & parcel watch a.html b.html | grep 'Built in'
โœจ Built in 294ms
โœจ Built in 21ms
โœจ Built in 9ms
โœจ Built in 13ms
โœจ Built in 9ms
โœจ Built in 8ms
โœจ Built in 9ms
โœจ Built in 12ms
โœจ Built in 16ms
โœจ Built in 14ms
^C

Coarsely bisecting nightlies:

  • Unaffected: 300โ€“319
  • Crashes: 320โ€“333
  • Affected: 337โ€“475

(Node v15.3.0, Yarn 1.22.5, Ubuntu 20.04.1 LTS; no Dropbox)

I was able to get the constant rebuild to stop by following these instructions for Dropbox to ignore files or folders, and ignoring node_modules, dist, and .parcel-cache.

I have not gone through the steps to narrow down exactly which folder was the culprit, but I figure it's not very important that Dropbox track those files anyway.

Might or might not be the same bug as https://github.com/parcel-bundler/parcel/issues/5355

Every time I make a change in a sass file, it seems to keep infinitely rebuilding. Anyone had this happen to them? I can fix this by deleting parcel-cache and if I make edits in any other files it builds only once. Only sass files it keeps rebuilding

I create a new example from scratch on my system and now works perfectly.

I have been working fine with no problems for a while.
Sometimes, when write an import to a .js file and save, infinite looping has started.

  • If I break (CTLR-C) and restart Parcel, it continues loop.
  • If I delete the .parcel-cache folder and restart Parcel, works correctly again.

Thank you! Completely the issue I was dealing with. Not sure what was in the cache triggering the change event, but it's simple enough to let parcel just rebuild.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

466023746 picture 466023746  ยท  3Comments

dotdash picture dotdash  ยท  3Comments

urbanhop picture urbanhop  ยท  3Comments

algebraic-brain picture algebraic-brain  ยท  3Comments

devongovett picture devongovett  ยท  3Comments