Skip to content

[TypeScript] Module resolution doesn't work in rollup.config.ts when using modern project settings #1662

@jdharrisnz

Description

@jdharrisnz

Expected Behavior

Compile as usual. Use npm run bug in my repl to see what happens.

Actual Behavior

Produces errors when compiling:

npx rollup --config rollup.config.ts --configPlugin typescript
loaded rollup.config.ts with warnings
(!) Plugin typescript: @rollup/plugin-typescript TS2349: This expression is not callable.
  Type 'typeof import("/home/runner/rollup-plugin-repro-typescript-import/node_modules/@rollup/plugin-typescript/types/index")' has no call signatures.

Additional Information

Key ingredients are:

  • "type": "module" in package.json
  • "moduleResolution": "NodeNext" or "Node16" in tsconfig.json
  • A rollup config file written in ESM format and TypeScript

The workaround is to use a JavaScript config file, so this is really the smallest of inconveniences, but it's something to fix nonetheless.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions