If you try to import this library from ESM code, you get a fatal error:
% npm i @filebase/client
npm WARN deprecated multiaddr-to-uri@8.0.0: This module is deprecated, please upgrade to @multiformats/multiaddr-to-uri
npm WARN deprecated multiaddr@10.0.1: This module is deprecated, please upgrade to @multiformats/multiaddr
added 314 packages in 12s
29 packages are looking for funding
run `npm fund` for details
% echo 'import { FilebaseClient } from "@filebase/client";' > foo.mjs
% node foo.mjs
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
Error [ERR_INVALID_PACKAGE_CONFIG]: Invalid package config /private/tmp/bar/node_modules/ipfs-car/dist/esm/package.json while importing /private/tmp/bar/node_modules/ipfs-car/dist/esm/pack/index.js. Unexpected token ''', "'{ "type" "... is not valid JSON
at new NodeError (node:internal/errors:399:5)
at getPackageConfig (node:internal/modules/esm/package_config:64:11)
at getPackageScopeConfig (node:internal/modules/esm/package_config:112:27)
at getPackageType (node:internal/modules/esm/resolve:690:25)
at Object.getFileProtocolModuleFormat [as file:] (node:internal/modules/esm/get_format:54:12)
at defaultGetFormatWithoutErrors (node:internal/modules/esm/get_format:103:43)
at defaultResolve (node:internal/modules/esm/resolve:1094:13)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:837:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:418:18) {
code: 'ERR_INVALID_PACKAGE_CONFIG'
}
Node.js v19.5.0
I ran into this because the js-ipfs packages all went ESM last year and I was trying upgrading a project that depended on this library to use ESM to make it easier to use the latest js-ipfs packages.
If you try to import this library from ESM code, you get a fatal error:
I ran into this because the js-ipfs packages all went ESM last year and I was trying upgrading a project that depended on this library to use ESM to make it easier to use the latest js-ipfs packages.