What is the plan for native code imports ?
import { x } from "./something.node";
I think they have similar issues to other parts of the require loader: Without running the code, it's not possible to tell what the exports are. So at most we'd support a default export.
Beyond that, IIRC there were multiple people concerned about adding support for native modules with proper WASM bindings just around the corner.
For now, the best way may be to set up a CJS wrapper that can interface with the native code.
For now, you can import native code into ESM via createRequire:
import { createRequire } from 'module';
const require = createRequire(import.meta.url);
const { x } = require('./something.node');
closing as it appears to have no movement and has a workaround, feel free to reopen
Most helpful comment
For now, you can import native code into ESM via
createRequire: