Closed reggi closed 1 month ago
I keep getting this too, i feel like I'm missing something 💀
error TS18003: No inputs were found in config file '/Users/thomasreggi/Desktop/commands/packages/command-center/.tshy/commonjs.json'. Specified 'include' paths were '["../src//*.ts","../src/*/.cts","../src//*.tsx","../src/*/.json"]' and 'exclude' paths were '["../src/*/.mts","../src/package.json"]'.
command-center git:(main) ✗ npm run prepare
> @reggi/command-center@1.0.0 prepare
> tshy
error TS18003: No inputs were found in config file '/Users/thomasreggi/Desktop/commands/packages/command-center/.tshy/commonjs.json'. Specified 'include' paths were '["../src/**/*.ts","../src/**/*.cts","../src/**/*.tsx","../src/**/*.json"]' and 'exclude' paths were '["../src/**/*.mts","../src/package.json"]'.
Found 1 error.
writing tsconfig files...
using existing tsconfig.json
building /Users/thomasreggi/Desktop/commands/packages/command-center
tshy config {
exports: { './package.json': './package.json', '.': './src/index.mts' }
}
exports {
'./package.json': './package.json',
'.': {
import: {
types: './dist/esm/index.d.mts',
default: './dist/esm/index.mjs'
}
}
}
set dialect { where: 'src', mode: 'esm' }
building esm
set dialect { where: '.tshy-build/esm', mode: 'esm' }
built esm
set dialect { where: 'src', mode: 'commonjs' }
building commonjs
build failed
When I just covert the 3 files that have zx
in tree to .mts
it works ✅
When I convert the whole project to .mts
it fails ❌ the project needs at least one .ts
file 😢
If you don't want to build a hybrid module (ie both esm and commonjs) then you really don't need to use tshy, which is a typescript hybridizer
if you want tshy to only build one sort of dialect, you can put "tshy": { "dialects": ["esm"] }
in package.json.
If you want to use a module that is only esm, from both esm and CJS, you'll need to use a dynamic import.
I want esm and commonjs
zx is not a esm only module though zx has exports require that point to cjs (but it also has type module)
Without
{"type": "module"}
and runtsc --noEmit
I get this error:Adding
{"type": "module"}
all good ✅When I run
npm run prepare
akatshy
I get the same error regardless of{"type": "module"}
.This is because durning the script, it's creating a
./src/package.json
file with{"type": "commonjs"}
🥲The only workaround is to use a
.mts
files.The fix should be to check the root package.json and get the type from there.