fromdeno / deno2node

Compile your Deno project to run on Node.js.
MIT License
117 stars 3 forks source link

Re-enable `noEmitOnError` #1

Closed wojpawlik closed 3 years ago

wojpawlik commented 3 years ago

@dsherret why does build fail (on Deno and Node.js) with Cannot find module 'ts-morph' even tho it is installed?

https://github.com/wojpawlik/deno2node/blob/3c9cf71a06a08d4c6db91ae4c4e0aeca40c30164/src/deno2node.ts#L3 Changing to from "ts-morph" and skipLibCheck don't help. Trying to import something else also fails.

wojpawlik commented 3 years ago

This happens even if I comment out all the transformations: https://github.com/wojpawlik/deno2node/blob/3c9cf71a06a08d4c6db91ae4c4e0aeca40c30164/src/deno2node.ts#L26-L41

What am I doing wrong?

dsherret commented 3 years ago

I'm not sure what the intent is here (didn't look too thoroughly), but after the module specifier is changed to "ts-morph", the TS compiler is then searching for the "ts-morph" module, but it can't find it because npm install was not run... so the module doesn't exist locally.

wojpawlik commented 3 years ago

obraz

dsherret commented 3 years ago

@wojpawlik yeah, I saw that, but are you creating a node.js build for this library using Deno? Anyway, the reason this is happening is because the module specifier is changed to "ts-morph", but I don't see npm install happening anywhere before checking diagnostics.

dsherret commented 3 years ago

@wojpawlik in other words, add npm install as a command on your CI before running this script. The ts-morph npm dependency is not being pulled down.

wojpawlik commented 3 years ago

I already did... 😕 obraz

dsherret commented 3 years ago

Oh, sorry. I never heard of npm ci and didn't know what it did (good to know about). I was just searching for npm install.

Maybe try the suggestion of setting the module resolution to "node". Does this run locally?

wojpawlik commented 3 years ago

Thank you, "moduleResolution": "node" works 🤦‍♂️

dsherret commented 3 years ago

@wojpawlik awesome. No problem!