wxt icon indicating copy to clipboard operation
wxt copied to clipboard

Types are incompatible with NodeNext tsconfig

Open lishaduck opened this issue 2 months ago • 4 comments

Describe the bug

The exported types don't use extensions, so they're faux esm and fail to import in modern moduleResolution settings.

Reproduction

https://arethetypeswrong.github.io/?p=wxt%400.20 (this is probably more minimal than my actual project)

Steps to reproduce

Given tsconfig.json of a wxt starter, add:

{
  "compilerOptions": {
    "module": "nodenext",
    "moduleResolution": "nodenext", 
  }
}

tsc should complain that Module '"wxt"' has no exported member ...

System Info

n/a

Used Package Manager

pnpm

Validations

lishaduck avatar Oct 27 '25 01:10 lishaduck

You should use moduleResolution: "bundler", since it's a bundler project... but I haven't kept up with this, so I might be wrong.

Why are you trying to use nodenext?

aklinker1 avatar Oct 27 '25 21:10 aklinker1

You should use moduleResolution: "bundler", since it's a bundler project... but I haven't kept up with this, so I might be wrong.

Why are you trying to use nodenext?

I was writing a wxt module package (lishaduck/wxt-sveltekit), wasn't bundling or nothing just native type-stripping.

lishaduck avatar Oct 27 '25 21:10 lishaduck

I see... I'm not familiar with how NodeNext module resolution works, can you provide an actual minimal project where if I run a command, I can see the problem?

aklinker1 avatar Oct 27 '25 21:10 aklinker1

Alright, https://github.com/lishaduck/wxt-nodenext-repro, pnpm i && pnpm repro (obv. very minimal and not representative of a real use case)

lishaduck avatar Oct 29 '25 05:10 lishaduck