Skip to content

Make library compatible with ESM and browsers#8

Merged
limesdotpink merged 8 commits intomasterfrom
feat/esm
Sep 2, 2025
Merged

Make library compatible with ESM and browsers#8
limesdotpink merged 8 commits intomasterfrom
feat/esm

Conversation

@mrjvs
Copy link
Copy Markdown
Contributor

@mrjvs mrjvs commented Sep 2, 2025

changes:

  • Updated compiler to tsup and add linting GH workflow (the same setup that BOSS and juxt uses)
  • Set up compiler to compile to both esm and cjs. Using esm as a base
  • Make it easier to run on the client:
    • Remove nodejs dependencies where possible (removed assert)
    • Do an explicit import for buffer, so polyfilling tools can recognize the dependency on Buffer (which doesnt exist on browser - in the long run we would probably want to use UInt8Array or ArrayBuffers, since those are available on both platforms)
    • Use crypto-js for md5, because its browser compatible. This will also shrink the bundle size when bundling for browser
    • (bitbuffer dependency is fine, it's written entirely in native JS)
  • Moved examples into an examples folder, otherwise it gets compiled and published with the library code.
  • Increased version number, so it can immediately be deployed as an update

There are no breaking changes for library users.


This will resolve bundling errors we are encountering with the nuxt refactor: PretendoNetwork/website#411

Comment thread .github/workflows/lint.yml Dismissed
Comment thread src/mii.ts Dismissed
@limesdotpink
Copy link
Copy Markdown
Member

limesdotpink commented Sep 2, 2025

🔥🔥🔥🔥🔥🔥

Thanks jvs!

Copy link
Copy Markdown
Member

@jonbarrow jonbarrow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@limesdotpink
Copy link
Copy Markdown
Member

let's get this merged!

@limesdotpink limesdotpink merged commit 7793d27 into master Sep 2, 2025
4 checks passed
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.

4 participants