Skip to content

Commit e8ffa36

Browse files
committed
added pathinfo comments for harmony reexport
1 parent 5aeef4a commit e8ffa36

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

‎lib/dependencies/HarmonyExportImportedSpecifierDependency.js‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,20 @@ HarmonyExportImportedSpecifierDependency.prototype.getReference = function() {
3030

3131
HarmonyExportImportedSpecifierDependency.Template = function HarmonyExportImportedSpecifierDependencyTemplate() {};
3232

33-
HarmonyExportImportedSpecifierDependency.Template.prototype.apply = function(dep, source) {
33+
HarmonyExportImportedSpecifierDependency.Template.prototype.apply = function(dep, source, outputOptions, requestShortener) {
3434
var name = dep.importedVar;
3535
var used = dep.originModule.isUsed(dep.name);
36+
var comment = "";
37+
if(outputOptions.pathinfo) comment = "/*! " + requestShortener.shorten(dep.request) + " */ ";
3638
var content;
3739
if(!used) {
3840
content = "/* ununsed harmony reexport " + (dep.name || "namespace") + " */;";
3941
} else if(dep.name === "default" && !dep.importDependency.module.meta.harmonyModule) {
40-
content = "/* harmony reexport */ Object.defineProperty(exports, " + JSON.stringify(dep.name) + ", {configurable: false, enumerable: true, get: function() { return " + name + "_default.a; }});";
42+
content = "/* harmony reexport */ Object.defineProperty(exports, " + JSON.stringify(dep.name) + ", {configurable: false, enumerable: true, get: function() { return " + comment + name + "_default.a; }});";
4143
} else if(dep.name) {
42-
content = "/* harmony reexport */ Object.defineProperty(exports, " + JSON.stringify(dep.name) + ", {configurable: false, enumerable: true, get: function() { return " + (name + "[" + JSON.stringify(dep.id) + "]") + "; }});";
44+
content = "/* harmony reexport */ Object.defineProperty(exports, " + JSON.stringify(dep.name) + ", {configurable: false, enumerable: true, get: function() { return " + comment + (name + "[" + JSON.stringify(dep.id) + "]") + "; }});";
4345
} else {
44-
content = "/* harmony namespace reexport */ for(var __WEBPACK_IMPORT_KEY__ in " + name + ") (function(key) { Object.defineProperty(exports, key, {configurable: false, enumerable: true, get: function() { return " + name + "[key]; }}) }(__WEBPACK_IMPORT_KEY__));";
46+
content = "/* harmony namespace reexport */ for(var __WEBPACK_IMPORT_KEY__ in " + comment + name + ") (function(key) { Object.defineProperty(exports, key, {configurable: false, enumerable: true, get: function() { return " + name + "[key]; }}) }(__WEBPACK_IMPORT_KEY__));";
4547
}
4648
source.insert(dep.position, content);
4749

0 commit comments

Comments
 (0)