m1212e / prismabox

typebox schema generator for prisma
MIT License
38 stars 7 forks source link

Support projects using nodenext module resolution #13

Closed Dan-Shields closed 3 months ago

Dan-Shields commented 4 months ago

When using nodenext/node16 module resolution, source imports must include the .js extension in the path, causing the following error in the generated schemas when __nullable__ is used:

Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './__nullable__.js'?

Perhaps a config option to include the file extensions should be added?

m1212e commented 4 months ago

Hi, I currently focused on creating typescript files but don't see an issue since no TS specific features are used at the moment, if I'm correct. Is there a way to switch your resolution setting, use a bundler etc. ?

Dan-Shields commented 4 months ago

To clarify, this is still within a typescript project, but using the more modern module resolution strategy of node16 requires you to include the .js extension when importing typescript files.

In the rest of my project I do .js imports for ts files, as I'm using straight tsc to transpile my backend code, with no babel or bundler.

This stackoverflow answer explains a bit more.

m1212e commented 4 months ago

I see. Never used that before so I'd be happy to review a PR since you probably know best what you need! If I can somehow help you, feel free to reach out!