-
Notifications
You must be signed in to change notification settings - Fork 151
Open
Description
Given a minimal tsconfig.json:
{}When running npx sucrase -p ., an error message occurs:
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of Buffer or URL. Received undefined
at Object.stat (node:fs:1615:10)
at /project/path/node_modules/mz/fs.js:58:8
at new Promise (<anonymous>)
at exports.exists (/project/path/node_modules/mz/fs.js:57:10)
at runGlob (/project/path/node_modules/sucrase/dist/cli.js:186:26)
at async buildDirectory (/project/path/node_modules/sucrase/dist/cli.js:299:13) {
code: 'ERR_INVALID_ARG_TYPE'
The problem occurs here
Lines 186 to 188 in 61c05e1
| if (!(await exists(options.outDirPath))) { | |
| await mkdir(options.outDirPath); | |
| } |
because outDirPath does not have a default value.
This error message is confusing and it took me digging in the sucrase code to find the answer.
I don't know what the right answer is for how it should behave, but some ideas are :
- Perhaps
outDirPathcan behave similarly totsc, which compiles files next to the originals ifcompilerOptions.outDiris not defined - Use the default of the common "dist" folder
- Print a more useful error that the
outDiris not defined intsconfig.json
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels