-
-
Notifications
You must be signed in to change notification settings - Fork 233
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
Cannot set property length of [object Object] #79
Comments
+1, causing me to need to start using npm shrinkwrap to get buffer 3.4.3 |
+1 |
Assuming this bug can be confirmed, what is the best course of action anyway? |
Depends on the cause. We can either try to fix it, or revert the |
The code i had that was causing this to show up was while using webpack and was unfortunately several libraries deep where it was triggered so i don't have a simple test case I know the file that directly had threw the error while using a buffer was https://github.com/primus/primus/blob/master/transformer.js likely not very helpful but you might be able to see a use case that would break it which is more obvious to you having written the buffer library |
@marioatlp Can you provide a stacktrace so we know where transformer was calling Buffer? |
haha it seems I could reproduce the issue. It's not buffer but Showcase: (check the console)
Code: https://github.com/purposeindustries/buffer-bug79 ps: you can solve the global transform by simply ignoring buffer: |
Looks like we're getting the same issue. |
@jlbruno in webpack: add
|
@oroce That solution is only helpful if the issue is a .jsx file in node_modules my issue was in standard JS. an alternative work around until this is fixed is to add to
|
Ok, thanks....looks like 3 solutions have worked. Shrinkwrap (locking buffer to 3.4.3 by editing node-libs-browser package.json), excluding node_modules, and adding buffer at a top level dependency locked to v 3.4.3. Thanks all. Time to figure out which is the least of the evils. |
found one other solution for webpack based on
|
@lostrouter I would recommend not running babel on third party code, as often the transforms can break code that is unaware of es6. Such as making modules option strict by default. |
I cross-referenced this issue against browserify, too. They should at least be aware of this issue. Since I use traceur instead of babel, my solution was |
3.4.3 still has the broken code:
|
Same here using webpack with https://github.com/mistadikay/strict-loader
|
Ok I ran the test suit inside the same browser I have the bug in, and it is all good. Maybe someone (webpack?) is doing a freeze on the object, or something else. |
Find it, don't add / use strict mode on Buffer.js mistadikay/strict-loader#5 (comment) |
I did a horrible patch in webpack for this issue that others might be able to use: ---- strict-stripper.js ------ ---- in webpack.config.js (loaders section) ------ |
So I take it the steps to fix this bug are:
In general, it looks like this could be fixed by simply hoisting the |
I can confirm that I can reproduce this by just adding |
^ fixed! |
nicely done, thank you! |
Nicely done! Fix released as 3.6.0. And just like that, we're down to 0 open issues and 0 open PRs! 👍 |
Buffer 3.5.0 breaks in Chrome (
45.0.2454.85 (Official Build) (64-bit)
)What I'm getting is
It happens when buffer tries to set
.prototype.length
toundefined
, here: https://github.com/feross/buffer/blob/master/index.js#L372I discovered this while I was rolling out our app's new version. Later I'm gonna try to put together a small demo.
(I'm using browserify 11.11.0 which uses
buffer@3.5.0
)The text was updated successfully, but these errors were encountered: