-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed as not planned
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code
Description
🔎 Search Terms
- --experimental-addon-modules
- ESM
- native extension
- .node
🕗 Version & Regression Information
- This has always been the case
- This is the behaviour in every version I tried, and I checked the FAQ for entries about importing native modules but none exist or I missed them
⏯ Playground Link
I don't see any way to include a native extension in the playground, so that's not possible. Here's a repo: https://github.com/getargv/getargv.js/tree/feature/esm
💻 Code
import addon from '../build/Release/getargv_native.node';🙁 Actual behavior
$ npm run build
> @camjn/getargv@0.0.31 prebuild
> tsc
lib/binding.ts:3:19 - error TS2307: Cannot find module '../build/Release/getargv_native.node' or its corresponding type declarations.
3 import addon from '../build/Release/getargv_native.node';
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
🙂 Expected behavior
Since node offers the --experimental-addon-modules flag and every node version from node20 on supports esm syntax, I expect to be able to use esm syntax to import native modules in typescript too.
Additional information about the issue
No response
Metadata
Metadata
Assignees
Labels
QuestionAn issue which isn't directly actionable in codeAn issue which isn't directly actionable in code