ckeditor5 icon indicating copy to clipboard operation
ckeditor5 copied to clipboard

[TS] tsc build is failing in vanilla-colorful in `node16` module resolution.

Open Witoso opened this issue 2 years ago • 3 comments

📝 Provide detailed reproduction steps (if any)

  1. Clone the repo https://github.com/ckeditor/js-nation-workshop
  2. cd meta/bonus
  3. Install deps.
  4. Remove skipLibCheck from the tsconfig.
  5. Change moduleResolution to node16 in the tsconfig.
  6. 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.

Witoso avatar May 24 '23 12:05 Witoso

For clarification, @Witoso why do you use moduleResolution with node16 set?

mlewand avatar May 24 '23 12:05 mlewand

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.

Witoso avatar May 24 '23 14:05 Witoso

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.

CKEditorBot avatar May 24 '24 03:05 CKEditorBot

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).

CKEditorBot avatar Jun 24 '24 03:06 CKEditorBot