[TS] tsc build is failing in vanilla-colorful in `node16` module resolution.
📝 Provide detailed reproduction steps (if any)
- Clone the repo https://github.com/ckeditor/js-nation-workshop
-
cd meta/bonus - Install deps.
- Remove
skipLibCheckfrom thetsconfig. - Change
moduleResolutiontonode16in thetsconfig. - Run
npx tsc.
✔️ Expected result
Project builds.
❌ Actual result
Errors in vanilla-colorful
node_modules/vanilla-colorful/lib/components/color-picker.d.ts:1:43 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../types.js'?
1 import type { AnyColor, ColorModel } from '../types';
~~~~~~~~~~
node_modules/vanilla-colorful/lib/entrypoints/hex.d.ts:1:80 - error TS2835: Relative import paths need explicit file extensions in EcmaScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean '../types.js'?
1 import type { ColorModel, ColorPickerEventListener, ColorPickerEventMap } from '../types';
If you'd like to see this fixed sooner, add a 👍 reaction to this post.
For clarification, @Witoso why do you use moduleResolution with node16 set?
This may be helpful: https://devblogs.microsoft.com/typescript/announcing-typescript-5-0/#moduleresolution-bundler
On the other hand, if you’re writing a library that’s meant to be published on npm, using the bundler option can hide compatibility issues that may arise for your users who aren’t using a bundler. So in these cases, using the node16 or nodenext resolution options is likely to be a better path.
but I must say it's tricky, and I don't understand fully the diff between node and node16.
There has been no activity on this issue for the past year. We've marked it as stale and will close it in 30 days. We understand it may still be relevant, so if you're interested in the solution, leave a comment or reaction under this issue.
We've closed your issue due to inactivity. We understand that the issue may still be relevant. If so, feel free to open a new one (and link this issue to it).