workers-honeycomb-logger icon indicating copy to clipboard operation
workers-honeycomb-logger copied to clipboard

ESM Support

Open jasonkuhrt opened this issue 1 year ago • 1 comments

I don't think this package works in a NodeNext TS ESM project context:

CleanShot 2023-03-21 at 14 03 48@2x

jasonkuhrt avatar Mar 21 '23 18:03 jasonkuhrt

This is one fix:

{
  "name": "@cloudflare/pages-plugin-honeycomb",
  "version": "1.0.2",
  "type": "module",
  "exports": {
    "." : {
      "import": "./index.js",
      "require": "./index.js",
      "types": "./index.d.ts"
    }
  },
  "files": [
    "index.js",
    "index.d.ts",
    "tsconfig.json"
  ],
  "scripts": {
    "build": "npx wrangler pages functions build --plugin --outfile index.js"
  },
  "dependencies": {
    "@cloudflare/workers-honeycomb-logger": "^2.3.3"
  }
}

If you need a dedicated CJS build then point to it with require and toss a package.json into the directory therein with "type": "commonjs".

jasonkuhrt avatar Mar 21 '23 18:03 jasonkuhrt