Skip to content

Commit

Permalink
Enable Object Rest Spread by default
Browse files Browse the repository at this point in the history
  • Loading branch information
arv committed Aug 10, 2018
1 parent dd99fa1 commit 543a929
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/assets/JSAsset.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class JSAsset extends Asset {
strictMode: false,
sourceType: 'module',
locations: true,
plugins: ['exportExtensions', 'dynamicImport']
plugins: ['exportExtensions', 'dynamicImport', 'objectRestSpread']
};

// Check if there is a babel config file. If so, determine which parser plugins to enable
Expand Down
7 changes: 7 additions & 0 deletions test/integration/object-rest-spread/object-rest-spread.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
var x = {a: 'a', b: 'b'};
var {a: y, ...ys} = x;
var z = {y, ...ys};

export default function () {
return {x, y, z, ys};
}
15 changes: 15 additions & 0 deletions test/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ describe('javascript', function() {
assert.equal(output.default(), 3);
});

it('should produce a basic JS bundle with object rest spread support', async function() {
let b = await bundle(__dirname + '/integration/es6/object-rest-spread.js');

assert.equal(b.assets.size, 1);

let output = await run(b);
assert.equal(typeof output, 'object');
assert.equal(typeof output.default, 'function');

let res = output.default();
assert.equal(res.y, 'a');
assert.deepEqual(res.z, {y: 'a', b: 'b'});
assert.deepEqual(res.ys, {b: 'b'});
});

it('should bundle node_modules on --target=browser', async function() {
let b = await bundle(__dirname + '/integration/node_require/main.js', {
target: 'browser'
Expand Down

0 comments on commit 543a929

Please sign in to comment.