Open
Description
Issue Summary
Using a named import like import { Twilio } from "twilio";
fails on node in ESM mode because node uses cjs-module-lexer to statistically analyze imports. Twilio's OpenAI generator generates code that cjs-module-lexer can't lex to determine the named exports.
Steps to Reproduce
- Create test.mjs (forces node to treat as ESM).
- Add
import { Twilio } from "twilio"
; - Run
node test.mjs
Code Snippet
import { Twilio } from "twilio";
Exception/Log
import { Twilio } from "twilio";
^^^^^^
SyntaxError: Named export 'Twilio' not found. The requested module 'twilio' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
Technical details:
- twilio-node version: 5.0.0
- node version: 20.12.2
Metadata
Metadata
Assignees
Labels
No labels