parcel-bundler / parcel

The zero configuration build tool for the web. πŸ“¦πŸš€

Home Page:https://parceljs.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Parcel cache doesn't invalidate after switching branches

benasher44 opened this issue Β· comments

πŸ› bug report

Switching branches doesn't seem to invalidate the cache properly. We're running parcel locally with this command: PORT=3001 parcel serve index.html --open --watch-dir ../. We typically don't have parcel running while switching branches.

We'd be willing to sponsor work on the parcel cache.

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

.parcelrc

{
  "extends": ["@parcel/config-default"],
  "reporters":  ["...", "parcel-reporter-static-files-copy"]
}

relevant part of package.json:

  "staticFiles": {
    "staticPath": "public"
  },
  "alias": {
    "__process_comment__": "COMMENT: Fixes an error encountered by Parcel when building the project. See https://github.com/parcel-bundler/parcel/issues/7697#issuecomment-1360074613",
    "process": "process/browser.js",
    "buffer": "buffer"
  },
  "browserslist": {
    "production": [
      "defaults and supports es6-module"
    ],
    "development": [
      "last 2 chrome version"
    ]
  },
  "targets": {
    "default": {
      "context": "browser",
      "outputFormat": "esmodule",
      "distDir": "./build"
    }
  },
  "@parcel/resolver-default": {
    "packageExports": true
  },

πŸ€” Expected Behavior

When switching branches, parcel invalidates relevant parts of the cache.

😯 Current Behavior

The cache doesn't seem to invalidate pretty frequently to the point where we're now in the habit of just removing the cache folder when switching git branches. In one case, parcel wouldn't boot until I cleared the cache, and there was no output.

πŸ’ Possible Solution

We're brand new to parcel (just switched from CRA and are overall loving it), so unfortunately we don't have the experience yet to intuit a solution yet.

πŸ”¦ Context

We're on the latest parcel (2.12.0), and this is the first version of parcel our team has used. So, unfortunately I can't say that this broken "since version X" or something like that.

If there's debug information we can provide when the cache doesn't seem to invalidate, please let us know how, and we'd happy to add flags to produce debug info β€” just need some instruction here!

I also realize that git has very little to do with the parcel cache, but it represents the general experience we're seeing.

πŸ’» Code Sample

N/A

🌍 Your Environment

Software Version(s)
Parcel 2.12.0
Node 20.12.2
npm/Yarn yarn 4.1.1
Operating System macOS 14.4.1