From 0ec77c5b3ee78ea499eb4c118eea35703bb7e5b1 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Thu, 11 May 2017 02:26:06 -0700 Subject: Add dynamic polyfills for older browsers (#2985) Fixes #2941 --- app/javascript/packs/application.js | 32 ++++++++------------------------ 1 file changed, 8 insertions(+), 24 deletions(-) (limited to 'app/javascript/packs/application.js') 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(, mountNode); -}); -- cgit