Skip to content

Add Brotli WASM module imports to package.json #40

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

oligamiq
Copy link

#31

@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@pimterry
Copy link
Member

Nice work, thanks @oligamiq! I'm away this week I'm afraid but I'll have a proper look at this and test everything next week and get back to you.

Copy link
Member

@pimterry pimterry left a comment

Choose a reason for hiding this comment

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

Still some open questions here I think. It would also be helpful if you could sign the CLA (see the CLA Assistant comment above)

package.json Outdated
"./web/bg.wasm": {
"types": "./pkg/brotli_wasm_bg.wasm.d.ts",
"import": "./pkg/brotli_wasm_bg.wasm",
"default": "./pkg/brotli_wasm_bg.wasm"
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't work as /pkg/ doesn't exist.

@@ -12,6 +12,16 @@
"browser": "./index.browser.js",
"require": "./index.node.js",
"default": "./index.web.js"
},
"./web": {
Copy link
Member

Choose a reason for hiding this comment

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

Can you explain more about why we need a separate /web path? The brotli_wasm.js file is already imported in index.web.js - can't we just export the methods directly from there? That would also allow us to also provide a single API to do this that worked for all targets.

I do agree there's improvements to make here, but I'm not sure that just adding more exports is correct. It really seems like we should be able to provide a small set of exports, correctly automatically select the right one for the environment, and export data in the formats required.

If that needs to be "JS export + raw WASM" export for environments that need to manage wasm import & init manually, that makes sense, but I'm not clear why we'd need "JS export + web JS export + web raw WASM export", which seems like what we're doing here.

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.

3 participants