-
Notifications
You must be signed in to change notification settings - Fork 0
Description
Bug: The published ESM package uses bare directory imports (export { broadcaster } from './broadcast') in dist/index.js. Node.js ESM requires explicit file extensions — these should be './broadcast/index.js'.
Root cause: tsconfig.json has "moduleResolution": "node" + "module": "ESNext". TypeScript resolves './rpc' → ./rpc/index.ts during compilation but doesn't rewrite the specifier in the output. Node.js ESM then fails with ERR_UNSUPPORTED_DIR_IMPORT.
Fix: Change to "moduleResolution": "nodenext" and add .js extensions to all relative imports in the source, or use a bundler like tsup to produce a single-file ESM output.
Reproduction: Import @anycable/serverless-js in any "type": "module" project and run it with Node.js (not bundled) — e.g., Netlify Functions, AWS Lambda ESM, or plain node --experimental-vm-modules.