Skip to content

Node ESM reports missing export error for type-only exports in .mts modules when using --experimental-strip-types flag #62691

@kevgeoleo

Description

@kevgeoleo

Version

v24.13.1

Platform

Linux KContainer 5.10.0-12-amd64 #1 SMP Debian 5.10.103-1 (2022-03-07) x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

Hi,

I would like to report a behavior in Node that can be reproduced using the below PoC:

  1. file.mts
import { Num } from "./types.mts";
console.log("ok");
  1. types.mts
export type Num = number;
  1. Run command: node --experimental-strip-types file.mts

How often does it reproduce? Is there a required condition?

No special condition

What is the expected behavior? Why is that the expected behavior?

execute without error, with type-only imports being safely ignored during --experimental-strip-types

root@KContainer:~/12296# bun run file.mts
ok

What do you see instead?

root@KContainer:~/12296# node file.mts
file:///home/c01kele/git/run/cerebras/deno/OPENAI/gpt5.1/filter/batch_2/cross_runtime/temp/12296/a.mts:1
import { Num } from "./types.mts";
         ^^^
SyntaxError: The requested module './types.mts' does not provide an export named 'Num

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    strip-typesIssues or PRs related to strip-types support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions