Workaround for ES modules
pdkn opened this issue · comments
if using "type": "module"
in package.json then
import { PartitionResponse } from "unstructured-client/dist/sdk/models/operations/";
needs to become
import { PartitionResponse } from "unstructured-client/dist/sdk/models/operations/index.js";
else error
Directory import ".../node_modules/unstructured-client/dist/sdk/models/operations" is not supported resolving ES modules imported from .../.netlify/functions-serve/upload/netlify/functions/upload.mjs
Did you mean to import "unstructured-client/dist/sdk/models/operations/index.js"?
Consider giving out of the box support for ES module.
Hi there! I've looked into this, and the autogenerated client here has been designed to be ESM compatible. Barrel files are not supported and so index.js will have to be a direct import.