From 1494e3f22e9691d6d32cf49fff583f72ef1cafcb Mon Sep 17 00:00:00 2001 From: Peter Velkov Date: Thu, 6 May 2021 21:57:04 +0300 Subject: [PATCH] feature: Include polyfill.io for web builds Provide a custom `HtmlWebpackPlugin` option to only bundle the script for polyfill.io for the web/mWeb platform - it's not needed for desktop as it already works with latest tech The `ResizeObserver` is added as it's not included in the `default` features It's needed for the app to work on iOS 12 mWeb Safari The `gated` flag is added to skip polyfilling a feature that is already supported natively by the browser --- config/webpack/webpack.common.js | 1 + web/index.html | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/config/webpack/webpack.common.js b/config/webpack/webpack.common.js index 6f52e4ea0a13..872ff9fe96a8 100644 --- a/config/webpack/webpack.common.js +++ b/config/webpack/webpack.common.js @@ -35,6 +35,7 @@ const webpackConfig = { new HtmlWebpackPlugin({ template: 'web/index.html', filename: 'index.html', + usePolyfillIO: platform === 'web', }), // Copies favicons into the dist/ folder to use for unread status diff --git a/web/index.html b/web/index.html index 6363008910a3..129f6b4d5c66 100644 --- a/web/index.html +++ b/web/index.html @@ -28,6 +28,10 @@ + <% if (htmlWebpackPlugin.options.usePolyfillIO) { %> + + + <% } %>