ENOENT .tshy-build-tmp/esm/package.json
DaniGuardiola opened this issue · 8 comments
I'm running into an issue. When running npx tshy
I'm getting this error:
~/projects/tailwind-ink$ bun install ink
bun add v1.0.7 (b0393fba)
installed ink@4.4.1
node:fs:581
return binding.open(
^
Error: ENOENT: no such file or directory, open '.tshy-build-tmp/esm/package.json'
at Object.openSync (node:fs:581:18)
at writeFileSync (node:fs:2344:35)
at writeDialectPJ (file:///home/dani/projects/tailwind-ink/node_modules/tshy/dist/esm/set-folder-dialect.js:15:5)
at default (file:///home/dani/projects/tailwind-ink/node_modules/tshy/dist/esm/set-folder-dialect.js:20:5)
at buildESM (file:///home/dani/projects/tailwind-ink/node_modules/tshy/dist/esm/build-esm.js:25:9)
at default (file:///home/dani/projects/tailwind-ink/node_modules/tshy/dist/esm/build.js:19:9)
at async main (file:///home/dani/projects/tailwind-ink/node_modules/tshy/dist/esm/index.js:26:5)
at async file:///home/dani/projects/tailwind-ink/node_modules/tshy/dist/esm/index.js:29:1 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '.tshy-build-tmp/esm/package.json'
}
Node.js v21.1.0
Windows WSL
Fresh repo so last version of everything. Repo was created with bun init
and module
/moduleResolution
was changed to NodeNext
to adapt to tshy apparently requiring it.
Tshy will work with either "module":"nodenext"
or "module":"node16"
(though "nodenext" is recommended, since it's more future-proof). I haven't tried it with Bun, I'll take a look at that.
@isaacs thanks for the quick response. FYI, the error is happening even after removing bun from the equation. Happy to share anything that could be useful to you.
Do you have a link to the repo where this is happening?
Tshy should be mkdirp
-ing that folder before trying to write into it. It does fail if there's nothing in src or no src folder, but in that case, it should fail with a very different error.
PD: repo - https://github.com/DaniGuardiola/tailwind-ink
It's messy because I'm currently extracting something that was part of a different project into a separate package.
Ah, so, you can't use tshy with noEmit
, which means you can't use it with allowImportingTsExtensions
. The point of this is to actually build javascript as both cjs and esm, so it does have to emit.
And I'm not sure if incremental
is going to work, either (See #26).
If you remove those tsconfig settings, then it just fails trying to import ink
in the commonjs build, since ink is ESM only. If you want to use ink in your lib, and have a cjs export, then you'll need a polyfill to pull it in with async import()
.
Thanks! I don't have incremental
anywhere in the tsconfig though, or do you mean something else?
Re: ink being ESM-only. Can I just export ESM? Or will it still fail? I know the point of tshy is dual export but I'm trying to use it because I'll probably generalize my setup in the future as a template for packages and I want to make sure dual-exporting is supported.
Update: just set "dialects": ["esm"]
and it didn't fail, so I think it's all good.
I'm closing here. I guess a bit of info about supported/unsupported tsconfig options would be useful in the README. Thank you so much!
Sorry, not incremental
, but composite
.
I guess a bit of info about supported/unsupported tsconfig options would be useful in the README.
No doubt. But there are just so many of them 😭