Fixed reusing node in destructuring plugin, which caused caching issue in helper-module-transforms (#6374)

This commit is contained in:
Mateusz Burzyński 2017-10-03 21:25:41 +02:00 committed by Henry Zhu
parent 91cde0148d
commit 68182bd69f
4 changed files with 13 additions and 1 deletions

View File

@ -211,7 +211,7 @@ export default function({ types: t }) {
if (t.isRestElement(prop)) {
this.pushObjectRest(pattern, objRef, prop, i);
} else {
this.pushObjectProperty(prop, objRef);
this.pushObjectProperty(prop, t.clone(objRef));
}
}
}

View File

@ -0,0 +1,3 @@
import { NestedObjects } from "./some-module"
const { Foo, Bar } = NestedObjects

View File

@ -0,0 +1,6 @@
"use strict";
var _someModule = require("./some-module");
const Foo = _someModule.NestedObjects.Foo,
Bar = _someModule.NestedObjects.Bar;

View File

@ -0,0 +1,3 @@
{
"plugins": ["transform-es2015-destructuring", "transform-es2015-modules-commonjs"]
}