Issue
I have these 2 very simple scripts in my npm package:
"prebuild": "rimraf dist types",
"build": "tsc",
I have both rimraf@^5.0.5
and typescript@^5.3.2
installed as development dependencies. Whenever I execute npm run build
I get inconsistent behavior:
- The first time I execute it (before any build files are created) it does nothing. No errors are thrown either.
- If I then simply execute
tsc
in the same working directory, it will generate build files as it should. - If I then run
npm run build
, it will work flawlessly, deleting the existingdist
andtypes
directories and then generating new build files. - If I then run
npm run build
again, it will delete thedist
andtypes
directories, but won't generate any new build files. No errors are thrown.
I would expect npm run build
to simply replace any existing dist
and types
directories withnew/updated build files every time I execute it.
Solution
An extension to the project's tsconfig (@sapphire/tsconfig
) was causing the issue.
It enabled the tsBuildInfoFile
option which generates a tsconfig.tsbuildinfo
upon transpilation. I added this file to be removed by rimraf
in the prebuild
script and it now works as expected.
Answered By - Viriato
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.