mirror of https://github.com/webpack/webpack.git
fixed this scope in harmony imports
This commit is contained in:
parent
417fdea9b6
commit
84eb9a2741
|
@ -38,10 +38,10 @@ HarmonyImportSpecifierDependency.Template = function HarmonyImportSpecifierDepen
|
|||
HarmonyImportSpecifierDependency.Template.prototype.apply = function(dep, source) {
|
||||
var content;
|
||||
if(dep.id === "default" && !(dep.importDependency.module.meta && dep.importDependency.module.meta.harmonyModule)) {
|
||||
content = "/* harmony import */ " + dep.importedVar + "_default.a";
|
||||
content = "(/* harmony import */0," + dep.importedVar + "_default.a)";
|
||||
} else if(dep.id) {
|
||||
var used = dep.importDependency.module.isUsed(dep.id);
|
||||
content = "/* harmony import */ " + dep.importedVar + "[" + JSON.stringify(used) + "]";
|
||||
content = "(/* harmony import */0," + dep.importedVar + "[" + JSON.stringify(used) + "])";
|
||||
} else {
|
||||
content = "/* harmony namespace import */ " + dep.importedVar;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
"use strict";
|
||||
|
||||
function returnThis() {
|
||||
return this;
|
||||
}
|
||||
|
||||
var a = returnThis;
|
||||
var b = returnThis;
|
||||
|
||||
export {
|
||||
a,
|
||||
b
|
||||
}
|
||||
|
||||
export default returnThis;
|
|
@ -0,0 +1,12 @@
|
|||
"use strict";
|
||||
|
||||
import d, {a, b as B} from "./abc";
|
||||
|
||||
import * as abc from "./abc";
|
||||
|
||||
it("should have this undefined on imported functions", function() {
|
||||
(typeof d()).should.be.eql("undefined");
|
||||
(typeof a()).should.be.eql("undefined");
|
||||
(typeof B()).should.be.eql("undefined");
|
||||
abc.a().should.be.eql(abc);
|
||||
});
|
Loading…
Reference in New Issue