Skip to content

Commit 3b8abad

Browse files
authored
adds ability to export module as es6 deafult export
1 parent a105a76 commit 3b8abad

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,9 @@ module.exports = function(content) {
125125
content = JSON.stringify(content);
126126
}
127127

128-
return "module.exports = " + content.replace(/xxxHTMLLINKxxx[0-9\.]+xxx/g, function(match) {
128+
var exportsString = config.exportAsEs6Default? "exports.default": "module.exports";
129+
130+
return exportsString + " = " + content.replace(/xxxHTMLLINKxxx[0-9\.]+xxx/g, function(match) {
129131
if(!data[match]) return match;
130132
return '" + require(' + JSON.stringify(loaderUtils.urlToRequest(data[match], root)) + ') + "';
131133
}) + ";";

0 commit comments

Comments
 (0)