-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Buffer not found when using msgpack-lite in production build #12717
Comments
I can't reproduce this. Your repro builds fine for me. Can you check and update the instructions so that we can reproduce it. |
Hello @anonymous-0545. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with |
Hello @ascorbic , thank you so much for the prompt response. I think I was not clear enough, build and serve don't have an issue but if you open the console you can see the error on the repro. I'm not using any functionality of the library on repro, just importing it on the index page but it fails on the runtime of the build. Here is the error when you visit the homepage of the
In other words, it builds without an error however, when serving the produced |
It looks like it's related to how the library is trying to load https://github.com/kawanet/msgpack-lite/blob/master/lib/buffer-global.js#L3-L7 It works in dev because it's not minified. There may be some Vite settings you could use to fix this but I'm not sure. I tried a couple of things without much luck. It comes down to the fact that this is a really old library that isn't playing nicely with a modern bundler. |
I see, I didn't notice that is not actively maintained and migrated to tiny-msgpack, and the issue is resolved, thanks. |
Astro Info
If this issue only occurs in one browser, which browser is a problem?
Chrome
Describe the Bug
Description
The
msgpack-lite
library works correctly in development but fails in the production build with a "Cannot read properties of undefined (reading 'Buffer')" error.Error Message
Details
The error occurs in the minified production build where the code looks like:
This corresponds to the following source code in development:
Environment
What's the expected result?
It should be loaded as expected.
Link to Minimal Reproducible Example
https://stackblitz.com/edit/github-zm7nbaeo?file=src%2Fpages%2Findex.astro
Participation
The text was updated successfully, but these errors were encountered: