Object-Assign-Deep icon indicating copy to clipboard operation
Object-Assign-Deep copied to clipboard

Build artifacts for npm with Babel

Open shockey opened this issue 7 years ago • 3 comments

Addresses (possibly fixes) #4.

This PR adds Babel as a devDependency, using it to build a JavaScript artifact for release that is compatible down to Node.js 4 and IE11 (not quite ES5, but this should be enough compatibility for almost anyone).

Here's what the output looks like, vs the original source: https://www.diffchecker.com/DBqpq8i4

shockey avatar May 08 '18 03:05 shockey

Hey @shockey, I can't merge this in because all users shouldn't be forced to take a performance hit to support the lowest common denominator. If you can modify it so someone can import/require a transpiled ES5 version separately, then I'll merge. e.g. var es5 = require("object-assign-deep/es5"); or import { es5 as objectAssignDeep } from "object-assign-deep";.

saikojosh avatar May 08 '18 11:05 saikojosh

Note that this fix wouldn't only be for Node v4. Having this issue on the frontend for Node v8 build. This would fix minification errors across many frontend builds.

brandonrobertz avatar May 11 '18 05:05 brandonrobertz

@saikojosh, it appears that the transpired form of the module doesn't have any significant differences with the original source, when benchmarked in Chrome:

image

JSPerf here: https://jsperf.com/object-assign-deep-transpilation

The benchmark passes two objects with 5 levels of nested objects, randomly keyed.

shockey avatar May 11 '18 17:05 shockey