Skip to content

Commit 1c0dd26

Browse files
committed
Add firing script
1 parent 3ee2403 commit 1c0dd26

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

index.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,23 @@ function generateEpilog(chunkId, imports, exports) {
8484
epilog += `
8585
}());`;
8686

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+
*/
99+
if (imports.length !== 0) {
100+
epilog += `
101+
window.require(['__webpack_export_0'], function() {});`;
102+
}
103+
87104
return epilog;
88105
}
89106

0 commit comments

Comments
 (0)