Merge pull request #6280 from loganfsmyth/only-transform-modules

Only transform 'this'->'undefined' and inject 'use strict' if module statements are present
This commit is contained in:
Logan Smyth
2017-09-23 11:24:52 -07:00
committed by GitHub
35 changed files with 87 additions and 71 deletions

View File

@@ -1,5 +1,6 @@
import template from "babel-template";
import {
isModule,
rewriteModuleStatementsAndPrepareHeader,
hasExports,
isSideEffectImport,
@@ -18,6 +19,8 @@ export default function({ types: t }) {
visitor: {
Program: {
exit(path, state) {
if (!isModule(path)) return;
const {
loose,
allowTopLevelThis,