Browser API depends on webpack
See original GitHub issueIssue Description
I tried importing it using const blake3 = await import('https://unpkg.com/blake3@2.0.0/browser.js?module')
and it failed with Uncaught ReferenceError: exports is not defined
. Seems the code is a mix of ES modules and CommonJS modules.
I also tried importing it using Parcel and it failed with Imports argument must be present and must be an object
. Checking this issue seems Parcel’s WASM importing behavior is different from webpack’s. Then, after, I tried importing it using webpack, it worked.
Is there a way to make it not dependent on webpack behavior?
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:5 (4 by maintainers)
Top Results From Across the Web
Concepts - webpack
webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable...
Read more >Using Webpack for API development! - DEV Community
A simple explanation of Webpack, what it does for you and why and how you could use it to build an Express API...
Read more >Browser Extension Webpack Boilerplate - GitHub
Google Chrome; Chromium; Mozilla Firefox; Firefox for Android; Opera; Microsoft Edge. Actual compatibility will depend on the APIs you used. MDN provides a ......
Read more >How I can provide an api url to my library that is run via the ...
A good approach is for the config.js to be aqutogenerated via webpack or gulp. In my case I use the gulp tool to...
Read more >Bundling Extensions - Visual Studio Code
Bundling Visual Studio Code extensions (plug-ins) with webpack. ... When VS Code is running in the browser, it can only load one file...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’ve fixed this in https://github.com/connor4312/blake3/commit/8c48e49f7747b86101c8eb79876d9daf9254ebc9.
There’s now a new import,
blake3/browser-async
, that exports an function which returns a promise that resolves to the module.I expanded the integration tests to test both Webpack and a plain
<script type="module">
import.I’ll look into this some more this evening most likely.