feat: WebIndexPlugin - Possibility to shape how bundles are emitted (… · fuse-box/fuse-box@f1ac7d5 · GitHub
More Web Proxy on the site http://driver.im/
You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jun 20, 2023. It is now read-only.
feat: WebIndexPlugin - Possibility to shape how bundles are emitted (#1144)
I have a scenario in which I am only loading JS if I am on a specific browser, supporting ES6 with async await. For all other browsers I am disabling the app. It is a corporate app so don't judge.
I can now do:
```html
<script type="text/javascript">
function isGeneratorSupported() {
try {
eval('(function*(){})()');
return true;
} catch (err) {
return false;
}
}
let c = document.getElementById('hiddenContent');
if (!isGeneratorSupported() || /MSIE \d|Trident.*rv:/.test(navigator.userAgent)) {
c.style.display = 'block';
} else {
$bundles
}
</script>
```
and
```js
WebIndexPlugin({
template: 'src/client/index.html',
emitBundles: bundles =>
bundles
.map(b => `document.write('<script type="text/javascript" src="${b}"><\\/script>');`)
.join('\n')
}),
```
0 commit comments