zlib error using `@jbrowse/react-linear-genome-view` with vite
See original GitHub issueI made a small test example of @jbrowse/react-linear-genome-vew
in an app build with vite. Basically I copied over the app code from here. I had to use the solution described here to polyfill stream
(for @gmod/gff
) and zlib
(for @gmod/cram
) (I left out all the other polyfills in that example).
The app builds, but encounters an error trying to display a CRAM track:
serverSideRenderedBlock.ts:135 TypeError: Cannot read properties of undefined (reading '-5')
at Zlib2._binding.onerror (node-modules-polyfills:zlib:357:26)
at Zlib._error (binding.js:264:8)
at Zlib._write (binding.js:222:10)
at Zlib.writeSync (binding.js:171:15)
at Gunzip.Zlib2._processChunk (node-modules-polyfills:zlib:510:31)
at zlibBufferSync (node-modules-polyfills:zlib:229:17)
at Object.gunzipSync (node-modules-polyfills:zlib:173:10)
at CramFile._uncompress (file.js:247:27)
at CramFile.readBlock (file.js:298:12)
at async CramSlice.getBlocks (index.js:208:19)
This also could be a bug in the zlib
polyfill, but I’m not really sure.
Code for a repro is here: https://codesandbox.io/s/ylt4t with the app running here: https://ylt4t.sse.codesandbox.io/.
Issue Analytics
- State:
- Created 2 years ago
- Comments:15
Top Results From Across the Web
Uncaught ReferenceError: global is not defined | React ...
Current behaviour Getting an Uncaught ReferenceError while using ... zlib error using @jbrowse/react-linear-genome-view with vite ...
Read more >@jbrowse/react-linear-genome-view - npm
Start using @jbrowse/react-linear-genome-view in your project by running `npm i @jbrowse/react-linear-genome-view`.
Read more >jbrowse/react-linear-genome-view examples - CodeSandbox
Learn how to use @jbrowse/react-linear-genome-view by viewing and forking example apps that make use of @jbrowse/react-linear-genome-view on CodeSandbox.
Read more >Vite.js build with lib option not loading react app - Stack Overflow
json and tsconfig.json with build with lib configuration, it worked properly using with normal vite build but fails does not work on build...
Read more >Embedded components - JBrowse
JBrowse React Linear Genome View ; vite, demo · source code (download), for vite, we use rollup to polyfill some node polyfills...
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
we could possibly also improve docs related to vite in our readme’s…will consider what can be done
a new version of @gmod/cram is published (v1.6.1) that switches to pako for browser bundles, so does not require a zlib polyfill
a similar thing was also added to @gmod/bbi which also used zlib and was published as v1.0.32 so it is possible you can use the code without a zlib polyfill now, but I haven’t confirmed that