Closed
Description
With #4811 merged we've decoupled ES6 module emit from the ES6 language level, allowing us to emit other module forms when targeting ES6. This brings up another interesting question - we parse all external modules in strict mode, ES6 or not, when this is only a requirement for ES6 modules. Should we fix this and make the parse dependent on the module selection? Or should we emit "use strict";
in non-ES6 forms so reality matches the parser? Even before #4811 we've actually had this wrong:
import * as foo from "./foo";
with (foo) {
}
We forbid the with
as per strict mode, but we're emitting an amd module without a "use strict";
indicator. To be correct, when not targeting es6 modules, we should either disable strict mode when parsing or emit a "use strict";
.