svelte-kanban icon indicating copy to clipboard operation
svelte-kanban copied to clipboard

Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is NodeNext

Open dev-guy opened this issue 1 year ago • 0 comments

I'm using NodeJS 20 with Typescript 5.2.

When I remove "moduleResolution": "NodeNext", everything seems to be fine. Apps can use this component as a library. I'm curious whether doing so is a bad idea. Will this bite us later?

  1. Check out this branch
  2. Change tsconfig.json and add "moduleResolution": "NodeNext" under "compilerOptions": This setting is described here. SvelteKit 1.24+ includes this setting when it is used to create a new app. Perhaps it is no longer needed in Typescript 5.2. In fact the article states that "module": should be set to NodeNext too (SvelteKit doesn't add it).
  3. Open src/lib/stores/index.ts in VSCode. src/lib/stores/board.ts exists in this folder. The error on every file (eg export * from './board';) is:
Relative import paths need explicit file extensions in EcmaScript imports when
'--moduleResolution' is 'node16' or 'nodenext'. Did you mean './board.js'? ts(2835)

dev-guy avatar Sep 19 '23 19:09 dev-guy