You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
pnpm build fails on a fresh clone: core's copy-css plugin copies into dist/ before it exists #183
On a fresh clone, the first pnpm build fails in @bprogress/core, and turbo skips every package that depends on it:
@bprogress/core:build: ERROR: [plugin: copy-css] ENOENT: no such file or directory, copyfile './src/index.css' -> './dist/index.css'
Tasks: 0 successful, 5 total
Failed: @bprogress/core#build
Running pnpm build a second time works (6 successful, 6 total), because by then the first run has created dist/. The husky pre-push hook runs pnpm build, so a contributor's first push from a new clone fails the same way.
Cause: packages/core/tsup.config.ts copies the CSS in an esbuild onEnd callback. tsup runs esbuild with write: false and writes the output files (creating dist/) after esbuild returns, so onEnd runs before dist/ exists. I checked this in tsup 8.4.0, the version in the lockfile.
Steps (pnpm 9.12.3, Node 24.14.1, macOS 26.4.1, main at f3c776a):
git clone https://github.com/imskyleen/bprogress.git && cd bprogress
pnpm install --frozen-lockfile
pnpm build → fails as above
pnpm build → passes
The published @bprogress/[email protected] tarball does include dist/index.css, so npm users aren't affected.
Two fixes I tried, each passing from an empty dist/ (2 of 2 runs, all 6 output files, index.css identical to the source):
Create the directory first: mkdirSync("./dist", { recursive: true }) before copyFileSync (and import mkdirSync).
Or drop the esbuild plugin and copy in tsup's onSuccess, which runs after the files are written:
Activity