Minimal reproduction:
// bar.mjs
import { BskyAgent } from '@atproto/api' // 0.2.10
console.log(BskyAgent)
Note that this code is .mjs so it's ES Module. Running node bar.mjs shows this error, probably typescript/babel/etc bundling issue:
file:///home/xnuk/scratchpad/bar.mjs:1
import { BskyAgent } from '@atproto/api'
^^^^^^^^^
SyntaxError: Named export 'BskyAgent' not found. The requested module '@atproto/api' 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 '@atproto/api';
const { BskyAgent } = pkg;
at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
Node.js v19.9.0
Minimal reproduction:
Note that this code is
.mjsso it's ES Module. Runningnode bar.mjsshows this error, probably typescript/babel/etc bundling issue: