-
Notifications
You must be signed in to change notification settings - Fork 6
Description
The @flatfile/api package currently only exports a CommonJS version, specified through the main field in package.json. It does not provide any ESM-compatible exports (e.g., via module or exports fields). This limitation makes it difficult to use the package with modern bundlers and frameworks that prefer or require ESM, such as Next.js.
It would be ideal if the package exported both CJS and ESM builds to enhance compatibility and align with modern JavaScript ecosystem standards. Providing an ESM build could involve using .mjs files or a package.json with "type": "module", while retaining the existing CJS build with .js (or .cjs if type: module) extensions ensures backward compatibility. Updating the package.json to include both main for CJS and module for ESM, alongside an exports field, would significantly improve compatibility. For example:
{
"main": "./dist/index.cjs",
"module": "./dist/index.mjs",
"types": "./dist/index.d.ts"
"exports": {
"types": "./dist/index.d.ts",
"require": "./dist/index.cjs",
"import": "./dist/index.mjs"
}
}