Open NfNitLoop opened 2 years ago
FWIW, still seeing this error (w/ a slightly different codebase) in dnt v0.32.0, ts-morph v17.0.1.
I'm looking into it a bit more because I'd really like to make Deno the canonical source for this library. :)
It turns out that if I just give it some more stack to work with, it completes:
easy to reproduce with these deno tasks:
"build-npm-debug": "deno run -A --v8-flags=--stack-trace-limit=999999 ./build/npm.ts",
//works:
"build-npm-bigstack": "deno run -A --v8-flags=--stack-size=2000 ./build/npm.ts",
// doesn't:
"build-npm": "deno run -A ./build/npm.ts",
Unfortunately, "completes" means it tells me that it can't find a type:
> deno task build-npm-bigstack
Task build-npm-bigstack deno run -A --v8-flags=--stack-size=2000 ./build/npm.ts
[dnt] Transforming...
[dnt] Running npm install...
added 26 packages, and audited 27 packages in 4s
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
[dnt] Building project...
[dnt] Type checking...
src/private/shim.ts:6:24 - error TS7016: Could not find a declaration file for module 'bs58check'. 'C:/Users/Cody/code/feoblog-client/npm/node_modules/bs58check/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/bs58check` if it exists or add a new declaration (.d.ts) file containing `declare module 'bs58check';`
6 import * as bs58c from "bs58check"
~~~~~~~~~~~
error: Uncaught (in promise) Error: Had 1 diagnostics.
throw new Error(`Had ${diagnostics.length} diagnostics.`);
^
at build (https://deno.land/x/dnt@0.32.0/mod.ts:315:15)
at async file:///C:/Users/Cody/code/feoblog-client/build/npm.ts:6:1
Now, when I import that from esm.sh like this:
import * as bs58c from "https://esm.sh/bs58check@2.1.2"
I get types. So esm is properly providing types to me. Shouldn't dnt just use those?
In the meantime I'm working around it by explicitly grabbing the type bindings by adding devDependencies to my build/npm.ts
:
devDependencies: {
"@types/bs58check": "*",
}
And now we're on to other shimming problems which I'll look into later. Sorry for the train-of-thought. Just trying to capture the use case of a new user. Several issues here that could probably be pulled out into their own tickets. Happy to do so if that helps:
FWIW, the workaround for my case was to stop using the library that was causing the issue. Not sure what about that library was causing the issue, but it was an easy enough work around. Once I figured out which library was causing the issue, which required firing up a debugger, because the error condition didn't make that clear.
So maybe another potential feature/improvement request is: add information about the current library being transformed to the output so that users can figure out which part failed more easily. :)
Super happy to have this working now. Thanks for making DNT!
Steps to reproduce:
deno task build-npm
Output: