Skip to content

Commit e7f2db7

Browse files
committed
Clean up placement and comment
1 parent 1c0dd26 commit e7f2db7

File tree

1 file changed

+5
-16
lines changed

1 file changed

+5
-16
lines changed

index.js

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,26 +81,15 @@ function generateEpilog(chunkId, imports, exports) {
8181
window.define(${jsonName}, ${jsonDefineStubs}, function() { return __webpack_exports__[${jsonId}]; });`;
8282
}
8383

84-
epilog += `
85-
}());`;
86-
87-
/**
88-
* Magento 2's RequireJS implementation appears
89-
* to only fire scripts when it needs to.
90-
*
91-
* Since this is a custom script, it won't
92-
* ever - by default - fire. So this is us forcing
93-
* the script in question to fire immediately.
94-
*
95-
* TODO: look into the exact process Magento 2
96-
* employs in doing this. There might be a smarter
97-
* way to handle execution.
98-
*/
9984
if (imports.length !== 0) {
85+
// Immediately require script
10086
epilog += `
101-
window.require(['__webpack_export_0'], function() {});`;
87+
window.require(['__webpack_export_${chunkId}'], function() {});`;
10288
}
10389

90+
epilog += `
91+
}());`;
92+
10493
return epilog;
10594
}
10695

0 commit comments

Comments
 (0)