Skip to content

Commit

Permalink
Remove IE polyfillsfrom the Blitz inject script
Browse files Browse the repository at this point in the history
Removes dependency on `polyfill.io`, which was recently sold.
https://twitter.com/triblondon/status/1761852117579427975
  • Loading branch information
bencroker committed Feb 27, 2024
1 parent 0610875 commit 4863e77
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Release Notes for Blitz

## 4.12.0 - Unreleased
## 4.12.0 - 2024-02-27

> {warning} Polyfills for IE have been removed from the Blitz inject script. If you need to support IE, you will need to add the polyfills yourself.
### Added

Expand All @@ -14,6 +16,9 @@
- Optimised the params that are stored on tracked element queries.
- Made the ordering of items displayed in the Blitz diagnostics utility deterministic.

### Removed

- Removed the `fetch`, `Promise` and `CustomEvent` polyfills for IE from the Blitz inject script, as they were pulling from `polyfill.io`. If you need to support IE, you will need to add the polyfills to your templates yourself.

## 4.11.2 - 2024-02-19

Expand Down
10 changes: 0 additions & 10 deletions src/variables/BlitzVariable.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
use putyourlightson\blitz\services\CacheRequestService;
use Twig\Markup;
use yii\web\NotFoundHttpException;
use yii\web\View as BaseView;

class BlitzVariable
{
Expand Down Expand Up @@ -296,15 +295,6 @@ private function _getScript(string $uri, array $params, VariableConfigModel $con
}
}

// Create polyfills using https://polyfill.io/v3/url-builder/.
$polyfills = ['fetch', 'Promise', 'CustomEvent'];
$polyfillUrl = 'https://polyfill.io/v3/polyfill.min.js?features=' . implode('%2C', $polyfills);

// Register polyfills for IE11 only, using the `module/nomodule` pattern.
// https://3perf.com/blog/polyfills/#modulenomodule
$view->registerJsFile($polyfillUrl, ['nomodule' => true]);
$view->registerJs($js, BaseView::POS_END);

$this->_injected++;
$id = $this->_injected;

Expand Down

0 comments on commit 4863e77

Please sign in to comment.