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

Parcel cache doesn't invalidate after switching branches #9692

Open
benasher44 opened this issue May 3, 2024 · 2 comments
Open

Parcel cache doesn't invalidate after switching branches #9692

benasher44 opened this issue May 3, 2024 · 2 comments

Comments

@benasher44
Copy link

benasher44 commented May 3, 2024

🐛 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
@benasher44
Copy link
Author

We ended up disabling the cache with --no-cache when doing local development, since our team was clearing the cache multiple times a day.

@mischnic
Copy link
Member

mischnic commented May 22, 2024

I've written a comment here: #9729 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants