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
Update 'buffer' to v5.x #1678
Update 'buffer' to v5.x #1678
Conversation
This looks good to me. Another option for users would be to depend on the buffer package explicitly or to do:
Users can also include a typed array polyfill: https://github.com/inexorabletash/polyfill/blob/master/typedarray.js |
buffer v5 requires Uint8Array to be defined. apparently it is not defined by default in node v0.10.
Sorry to bother you, but I'm not sure if this means IE8-10 compatibility is compromised for every bundle I build using browserify, of it's only when I use |
This patch only affects when your code uses |
@lorenzos One way to quickly find out of you're using If running |
Is there a recommended solution for those of us who are targeting audiences restricted to those versions of IE (e.g. certain federal agencies of the USA)? Sticking to v13 is only a viable option if hotfixes can be expected if security problems arise. |
@JDvorak Browserify usually runs in development (as a build step), not on production servers, so security issues are unlikely. To continue using an older version of buffer, you can do the following: $ npm install buffer@4 --save
$ browserify -r buffer/:buffer main.js > bundle.js |
@JDvorak Out of curiosity, what is the oldest version of IE that government agencies (or your agency) is required to support? |
@substack @feross Thank you very much for your explanation, I checked with |
@feross IE8 is typically all that is allowed in groups still restricted to
WindowsXP. In the more modernized agencies, you are looking at IE10 or
years old "secure" variations of Firefox (best case scenario). On the
server side of things, it is all over the place (with substantial use of an
increasingly unique fork of Windows Server.) It depends a lot on when the
department was established, the mass and inertia of their existing tool
chains, and the attitudes of the leadership. A good chunk of the stragglers
in browser use statistics are, in all likelihood, probably government work
computers.
|
IE10 supports Uint8Array so it should work on IE10, only IE8 and IE9 is left behind. |
Anyway, IE8 support was dropped when introduced |
Whew
…On Mon, Jan 30, 2017 at 5:24 AM Gábor Tóth ***@***.***> wrote:
Anyway, IE8 support was dropped when introduced Array.isArray method in
13.0.1.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#1678 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAyH-JfACEHOuJQpP_MxrR3mJWCCZs5Lks5rXeSogaJpZM4Ls7yH>
.
|
@tgabi333 Unfortunately, IE10's Uint8Array support is buggy, where sometimes I thought about letting IE10 use the typed array implementation now -- since a buggy implementation would be better than none. But IE10 also lacks support for |
@substack How do you accomplish this buffer replacement with buffer 4 when using the Browserify API, not command line? This doesn't appear to work:
It errors out: I'm trying to use Tape with older browsers, which recommends Browserify as the build tool, which thanks to this PR, no longer supports older IEs, as described here. |
One way or another, we need to restore IE support of packages using Buffer by default here. What paths are available? |
Also, I hesitate to use the method of adding a global polyfill for Uint8Array or some other type not supported in older browsers, since my library is focused on types themselves. Having these polyfills globally visible could affect the purity of my testing environment, which already falls back when certain types are not detected. Alternatively, I could increase the complexity of my type testing to check un-polyfillable parts of the types. |
FWIW, the API equivalent to b.require(require.resolve('buffer/'), { expose: 'buffer' }) |
@goto-bus-stop Thank you. This code does indeed cause the older version of Buffer to be used. However, it also causes the start of the built file to contain: "use strict";
require = function () {
... Since it's in strict mode, and require isn't already defined in the file, this causes an error: Changing it manually to use the window reference does work, however: "use strict";
window.require = function () {
... However, having to manually go in and do string replacements on built files is a bad precedent. I don't need to expose buffer externally, only do the reference swap as described above. I'm curious why Browserify would create invalid code here. |
is your build process adding
this is indeed a side effect of the current 'solution' for aliasing, and it's not ideal. |
@goto-bus-stop You are right. One instance of Babel was adding it. Ouch, ok. |
i have the same problem any solution please.i use truffle drizzle-react-native |
Browser support
buffer v5.x drops support for IE8-10.
This allows us to remove the
Object
implementation and rely on a singlefast implementation based on Typed Arrays, greatly simplifying the maintanence of the
buffer package.
Typed arrays are supported by 97.08% of the U.S. browser market and 92.02% of the
global browser market. Source: http://caniuse.com/#search=typed This number
continues to increase at a steady rate each month.
If IE8-10 support is critical to your web app, you can continue to rely on
browserify v13.
Bundle size
This change shrinks the size of buffer modestly.
55.1kb -> 52.1kb (full size, with comments)
7.0kb -> 6.7kb (minified, gzipped)
Bug fixes
buffer v5.x contains several important fixes including:
Semver
This should be released as semver major.