Re-queue nodes inserted with .replaceWith and centralize logic - fixes T2817
This commit is contained in:
@@ -125,6 +125,11 @@ export default function () {
|
||||
|
||||
visitor: {
|
||||
ThisExpression(path, state) {
|
||||
// If other plugins run after this plugin's Program#exit handler, we allow them to
|
||||
// insert top-level `this` values. This allows the AMD and UMD plugins to
|
||||
// function properly.
|
||||
if (this.ranCommonJS) return;
|
||||
|
||||
if (
|
||||
state.opts.allowTopLevelThis !== true &&
|
||||
!path.findParent((path) => !path.is("shadow") &&
|
||||
@@ -136,6 +141,8 @@ export default function () {
|
||||
|
||||
Program: {
|
||||
exit(path) {
|
||||
this.ranCommonJS = true;
|
||||
|
||||
let strict = !!this.opts.strict;
|
||||
|
||||
let { scope } = path;
|
||||
|
||||
Reference in New Issue
Block a user