diff options
author | Nolan Lawson <nolan@nolanlawson.com> | 2017-05-11 02:26:06 -0700 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-05-11 11:26:06 +0200 |
commit | 0ec77c5b3ee78ea499eb4c118eea35703bb7e5b1 (patch) | |
tree | f3a2d6dd6b0ba55f2d7e8be787b072af6c97da82 /app/javascript/packs | |
parent | 2d000e9c4e082bf7ca8b180e90a061486d199381 (diff) |
Add dynamic polyfills for older browsers (#2985)
Fixes #2941
Diffstat (limited to 'app/javascript/packs')
-rw-r--r-- | app/javascript/packs/application.js | 32 |
1 files changed, 8 insertions, 24 deletions
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js index 367b7e76a..06f47b6b0 100644 --- a/app/javascript/packs/application.js +++ b/app/javascript/packs/application.js @@ -1,25 +1,9 @@ -import Mastodon from 'mastodon/containers/mastodon'; -import React from 'react'; -import ReactDOM from 'react-dom'; -import Rails from 'rails-ujs'; -import 'font-awesome/css/font-awesome.css'; -import '../styles/application.scss'; - -if (!window.Intl) { - require('intl'); - require('intl/locale-data/jsonp/en.js'); +import main from '../mastodon/main'; + +if (!window.Intl || !Object.assign || !Number.isNaN || + !window.Symbol || !Array.prototype.includes) { + // load polyfills dynamically + import('../mastodon/polyfills').then(main); +} else { + main(); } - -window.Perf = require('react-addons-perf'); - -Rails.start(); - -require.context('../images/', true); -require.context('../../assets/stylesheets/', false, /custom.*\.scss$/); - -document.addEventListener('DOMContentLoaded', () => { - const mountNode = document.getElementById('mastodon'); - const props = JSON.parse(mountNode.getAttribute('data-props')); - - ReactDOM.render(<Mastodon {...props} />, mountNode); -}); |