Ensure regenerator option for babel-plugin-transform-runtime doesn't cancel out core-js polyfill

This commit is contained in:
Sebastian McKenzie 2016-01-06 15:26:00 +00:00
parent b28803c698
commit 72c091b63a

View File

@ -24,11 +24,9 @@ export default function ({ types: t }) {
visitor: { visitor: {
ReferencedIdentifier(path, state) { ReferencedIdentifier(path, state) {
if (state.opts.regenerator === false) return;
let { node, parent, scope } = path; let { node, parent, scope } = path;
if (node.name === "regeneratorRuntime") { if (node.name === "regeneratorRuntime" && state.opts.regenerator !== false) {
path.replaceWith(state.get("regeneratorIdentifier")); path.replaceWith(state.get("regeneratorIdentifier"));
return; return;
} }