Skip to content

Conversation

@ScreamZ
Copy link

@ScreamZ ScreamZ commented Nov 4, 2024

@endel Had issue with your ESM code

you can try it with a simple with bun (ou deno or node as u which), the important part is "type": "module" or use a .mjs file.

import Timer from "@colyseus/timer"

const timer = new Timer();
{
  "name": "sandbox",
  "module": "index.ts",
  "type": "module",
  "devDependencies": {
    "@types/bun": "latest"
  },
  "peerDependencies": {
    "typescript": "^5.0.0"
  },
  "dependencies": {
    "@colyseus/timer": "^1.0.0"
  }
}

, so i rewrote full clock and timer (as they depends on each others.)

They both works in commonJS and ESM.

  • Added CI checks with github workflows

Based on work from https://www.totaltypescript.com/how-to-create-an-npm-package for best practice and ensure export are stable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant