Skip to content

TypeScript example fails to compile #281

@dandv

Description

@dandv

Out of the box, the TypeScript example at fails to compile:

node --loader=ts-node/esm index.ts

(node:20) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("ts-node/esm", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)
file:///home/projects/stackblitz-starters-bkpyr8/index.ts:2
import { Client } from 'node-mailjet';
         ^^^^^^
SyntaxError: Named export 'Client' not found. The requested module 'node-mailjet' 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:

import pkg from 'node-mailjet';
const { Client } = pkg;

    at _instantiate (node:internal/modules/esm/module_job:155:1617)

Node.js 18.20.3

Online demo: https://stackblitz.com/edit/stackblitz-starters-bkpyr8?file=index.ts&view=editor

PS: is this module maintained any more? There hasn't been any activity since November.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions