brc-dd / iron-webcrypto

A cryptographic utility for sealing a JSON object using symmetric key encryption with message integrity verification.

Home Page:https://jsdocs.io/package/iron-webcrypto

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Buffer is not tree-shakable

pi0 opened this issue · comments

Hi dear @brc-dd. Recently we have added session support to h3 which exposes it to all Nitro and Nuxt 3 users as well.

A post-release issue I have discovered is that fixture sizes significantly increased https://github.com/nuxt/nuxt/actions/runs/4108883436/jobs/7090085836 for server bundle size. Investigating more, i have found that it is becaue of buffer polyfill added from the entrypoint.

For context, Nuxt and Nitro already polyfill Buffer for nodeless environments using unenv framework so this is not needed.

I am wondering is it possible if you can expose a subpath without Buffer polyfill? 🙏🏼 (another nice alternative, would be supporting export conditions to avoid doing this for node conditions at least)

Update: As a temporary workaround, inlining iron-webcrypto into h3 code. (unjs/h3@c50505b)

Hey, can you try if v0.3.1 works? It doesn't seem to work locally for me (Nuxt isn't picking the "node" exports). Might be an issue with the order in exports. Not sure though.

Thanks for the updates. Much nicer with UInt/base64 👍🏼 ❤️

(BTW checking the previous build, it seems was okay. node condition happens for files inside server/ directory using icon-webcrypto)

Ah, actually I had not run cleanup 😅