StellateHQ / fuse

Fuse: The fastest way to build and query great APIs with TypeScript
https://fusedata.dev
MIT License
550 stars 13 forks source link

Discussion: Config option for including .js on import paths #138

Open corydeppen opened 8 months ago

corydeppen commented 8 months ago

Summary

When Fuse generates files in a Node project with the module compiler option set to NodeNext, the import paths cause a TS error:

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

Code Generator has an emitLegacyCommonJSImports option for controlling whether to add the .js extension to import paths. If gql.tada will be preferred over codegen going forward, would it be possible to include a way to control the import paths in generated Fuse files?

JoviDeCroock commented 8 months ago

That's a good point, we can def include that when we check the tsconfig - I reckon we'll need to fix this in the LSP though 😅