Skip to content

Commit

Permalink
chore: remove fetch polyfill from bundle
Browse files Browse the repository at this point in the history
BREAKING CHANGE: fetch polyfill has been removed. add your own polyfill
to use SDK in old browsers.
  • Loading branch information
andrepolischuk committed Apr 5, 2021
1 parent 754f533 commit 129b024
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 17 deletions.
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,7 @@
"dependencies": {
"babel-runtime": "^6.26.0",
"lodash.debounce": "^4.0.8",
"sane-domparser-error": "^0.2.0",
"whatwg-fetch": "^2.0.4"
"sane-domparser-error": "^0.2.0"
},
"devDependencies": {
"@commitlint/cli": "^7.0.0",
Expand Down
2 changes: 1 addition & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const plugins = [
];

// NOTE: don't include external dependencies into esm/cjm bundles
const external = ['babel-runtime/regenerator', 'lodash.debounce', 'sane-domparser-error', 'whatwg-fetch'];
const external = ['babel-runtime/regenerator', 'lodash.debounce', 'sane-domparser-error'];

// NOTE: see https://github.com/rollup/rollup/issues/408 to understand why we silences `THIS_IS_UNDEFINED` warnings
const onwarn = (warning, warn) => {
Expand Down
8 changes: 1 addition & 7 deletions src/adUnit/helpers/fetch/fetchHtml.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
// eslint-disable-next-line import/no-unassigned-import
import 'whatwg-fetch';

const isValidContentType = (contentType) => {
const normalisedCT = contentType.toLowerCase();

return [
'text/plain',
'text/html'
].some((allowedType) => normalisedCT.includes(allowedType));
return ['text/plain', 'text/html'].some((allowedType) => normalisedCT.includes(allowedType));
};

const fetchHtml = async (endpoint) => {
Expand Down
3 changes: 0 additions & 3 deletions src/vastRequest/helpers/fetch.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-disable filenames/match-exported, import/no-unassigned-import */
import 'whatwg-fetch';

const fetch = async (endpoint, options = {}) => {
const defaults = {
credentials: 'include'
Expand Down
4 changes: 0 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -10344,10 +10344,6 @@ whatwg-encoding@^1.0.1, whatwg-encoding@^1.0.3:
dependencies:
iconv-lite "0.4.24"

whatwg-fetch@^2.0.4:
version "2.0.4"
resolved "http://registry.npmjs.org/whatwg-fetch/-/whatwg-fetch-2.0.4.tgz#dde6a5df315f9d39991aa17621853d720b85566f"

whatwg-mimetype@^2.1.0, whatwg-mimetype@^2.2.0:
version "2.3.0"
resolved "https://registry.yarnpkg.com/whatwg-mimetype/-/whatwg-mimetype-2.3.0.tgz#3d4b1e0312d2079879f826aff18dbeeca5960fbf"
Expand Down

0 comments on commit 129b024

Please sign in to comment.