Default Cache folder location is on root instead of workspace folder
Tri125 opened this issue Β· comments
π bug report
According to the documentation, by default the cache folder should be stored in the .parcel-cache folder inside your project.
When using parcel with npm workspaces I observed that the cache is stored on the root level but I would have expected it to be stored under the workspace folder.
π Configuration (.babelrc, package.json, cli command)
// root package.json - overly simplified sample
{
"name": "@examples",
"main": "index.js",
"scripts": {
"start:first": "npm run -w first start",
"start:second": "npm run -w second start"
},
"workspaces": [
"./apps/*"
],
"engines": {
"node": ">=14.21.3",
"npm": ">=7.24.2"
},
"devDependencies": {
"parcel": "^2.11.0"
}
}
// workspace package.json for workspace 'first' - overly simplified sample
{
"name": "first",
"main": "index.js",
"private": true,
"scripts": {
"start": "parcel *.html --no-cache"
},
}
/myProject
βββ apps
β βββ first
β β βββ index.html
β β βββ script.js
β β βββ package.json
β βββ second
β β βββ index.html
β β βββ script.js
β β βββ package.json
βββ package.json
βββ package-lock.json
From the root directory I would execute the following command:
npm run start:first
I am aware that the sample that I'm sharing here does disable reading from the cache .
π€ Expected Behavior
From reading the documentation, I was expecting the following structure with the cache being created under the project folder being currently executed :
/myProject
βββ apps
β βββ first
β β βββ .parcel-cache
β β β βββ data.mbd
β β β βββ lock.mbd
β β βββ index.html
β β βββ script.js
β β βββ package.json
β βββ second
β β βββ index.html
β β βββ script.js
β β βββ package.json
βββ package.json
βββ package-lock.json
π― Current Behavior
The cache is created on the root level.
/myProject
βββ .parcel-cache
β βββ data.mbd
β βββ lock.mbd
βββ apps
β βββ first
β β βββ index.html
β β βββ script.js
β β βββ package.json
β βββ second
β β βββ index.html
β β βββ script.js
β β βββ package.json
βββ package.json
βββ package-lock.json
π Possible Solution
As a workaround /apps/first/package.json
can specify the --cache-dir
cli option and the cache will be correctly created under /apps/first
.
π¦ Context
A slight confusion but with a rather straight forward workaround. No impact.
π Your Environment
Software | Version(s) |
---|---|
Parcel | 2.11.0 |
Node | 14.21.3 |
npm/Yarn | npm 8.19.4 |
Operating System | Windows 10 |