From 2f189826ab469b67bb37122647bc935870043962 Mon Sep 17 00:00:00 2001 From: Paul Chavard Date: Tue, 11 Sep 2018 17:53:11 +0200 Subject: [PATCH] Add some usefull polyfills for old browsers --- app/javascript/packs/application-old.js | 6 +----- app/javascript/packs/application.js | 6 +----- app/javascript/shared/polyfills.js | 5 +++++ package.json | 1 + yarn.lock | 4 ++++ 5 files changed, 12 insertions(+), 10 deletions(-) create mode 100644 app/javascript/shared/polyfills.js diff --git a/app/javascript/packs/application-old.js b/app/javascript/packs/application-old.js index 44fa321c8..214d87b4e 100644 --- a/app/javascript/packs/application-old.js +++ b/app/javascript/packs/application-old.js @@ -1,13 +1,9 @@ +import '../shared/polyfills'; import Turbolinks from 'turbolinks'; import Rails from 'rails-ujs'; import ActiveStorage from '../shared/activestorage/ujs'; import jQuery from 'jquery'; -// Include runtime-polyfills for older browsers. -// Due to .babelrc's 'useBuiltIns', only polyfills actually -// required by the browsers we support will be included. -import 'babel-polyfill'; - import '../shared/sentry'; import '../shared/rails-ujs-fix'; import '../shared/safari-11-file-xhr-workaround'; diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 971840e3a..196074a15 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,3 +1,4 @@ +import '../shared/polyfills'; import Turbolinks from 'turbolinks'; import Rails from 'rails-ujs'; import ActiveStorage from '../shared/activestorage/ujs'; @@ -5,11 +6,6 @@ import Chartkick from 'chartkick'; import Highcharts from 'highcharts'; import jQuery from 'jquery'; -// Include runtime-polyfills for older browsers. -// Due to .babelrc's 'useBuiltIns', only polyfills actually -// required by the browsers we support will be included. -import 'babel-polyfill'; - import '../shared/sentry'; import '../shared/rails-ujs-fix'; import '../shared/safari-11-file-xhr-workaround'; diff --git a/app/javascript/shared/polyfills.js b/app/javascript/shared/polyfills.js new file mode 100644 index 000000000..09b38e23e --- /dev/null +++ b/app/javascript/shared/polyfills.js @@ -0,0 +1,5 @@ +// Include runtime-polyfills for older browsers. +// Due to .babelrc's 'useBuiltIns', only polyfills actually +// required by the browsers we support will be included. +import 'babel-polyfill'; +import 'dom4'; diff --git a/package.json b/package.json index b68dcd7ed..b4869572f 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "autocomplete.js": "^0.31.0", "chartkick": "^2.3.6", "debounce": "^1.2.0", + "dom4": "^2.1.3", "highcharts": "^6.1.1", "jquery": "^3.3.1", "leaflet": "^1.3.1", diff --git a/yarn.lock b/yarn.lock index 72a33df3d..2921fab46 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2319,6 +2319,10 @@ doctrine@^2.1.0: dependencies: esutils "^2.0.2" +dom4@^2.1.3: + version "2.1.3" + resolved "https://registry.yarnpkg.com/dom4/-/dom4-2.1.3.tgz#f71808fe1f141e4da4ebc43ad5ddb3dd521f2767" + domain-browser@^1.1.1: version "1.2.0" resolved "https://registry.yarnpkg.com/domain-browser/-/domain-browser-1.2.0.tgz#3d31f50191a6749dd1375a7f522e823d42e54eda"