-
Notifications
You must be signed in to change notification settings - Fork 25
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
base: main
Are you sure you want to change the base?
Conversation
|
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. |
There was a problem hiding this 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" |
There was a problem hiding this comment.
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": { |
There was a problem hiding this comment.
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.
#31