Skip to content

[Bug]: Node16 moduleResolution error when building custom package #918

@tspng

Description

@tspng

Bug description

Hi, I was about to create a custom plugin.
Trying to build a custom build (tom-select.custom.js) fails with the following error:

> [email protected] build
> grunt build --plugins=remove_button,restore_on_backspace

... snip uninteresting parts ...

> [email protected] build:js:esm
> tsc -p .config/tsconfig.esm.json

src/tom-select.custom.ts(2,23): error TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Did you mean './tom-select.js'?
Warning: Command failed: npm run build:js
 Use --force to continue.

Aborted due to warnings.

The issue is that the generated tom-select.custom.ts imports ./tom-select without the .js extension.
It's an easy fix and I can create a PR if interested.

Expected behavior

Running npm build with the --plugins option should complete successfully without TypeScript errors.

Steps to reproduce

  1. Clone the repo, get on master branch
  2. Run npm install
  3. Run npm run build -- --plugins=remove_button,restore_on_backspace
  4. See error: TS2835: Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'

Additional context

  • OS: macOS 15.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions