diff options
author | Akihiko Odaki <akihiko.odaki.4i@stu.hosei.ac.jp> | 2017-07-18 07:19:02 +0900 |
---|---|---|
committer | Eugen Rochko <eugen@zeonfederated.com> | 2017-07-18 00:19:02 +0200 |
commit | b11ac88692ad7a8765b0b15e6d7a882d171ffe81 (patch) | |
tree | e59594a654b0142a459fa62fb589682b62ef7f07 /app/javascript/mastodon | |
parent | 681c33d1f4c395742918eb66f2db979b0d628118 (diff) |
Require any modules after loading polyfill in entry points (#4231)
app/javascript/mastodon/main.js delayed the execution of modules, but other entry points didn't. That leads to failure in executing modules, which requires those polyfills. Strictly enforce the rule to require any modules after loading polyfill in entry points.
Diffstat (limited to 'app/javascript/mastodon')
-rw-r--r-- | app/javascript/mastodon/main.js | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js index cc422c109..a7fc22a00 100644 --- a/app/javascript/mastodon/main.js +++ b/app/javascript/mastodon/main.js @@ -1,12 +1,14 @@ +import * as OfflinePluginRuntime from 'offline-plugin/runtime'; +import * as WebPushSubscription from './web_push_subscription'; +import Mastodon from 'mastodon/containers/mastodon'; +import React from 'react'; +import ReactDOM from 'react-dom'; import ready from './ready'; const perf = require('./performance'); function main() { perf.start('main()'); - const Mastodon = require('mastodon/containers/mastodon').default; - const React = require('react'); - const ReactDOM = require('react-dom'); if (window.history && history.replaceState) { const { pathname, search, hash } = window.location; @@ -23,9 +25,6 @@ function main() { ReactDOM.render(<Mastodon {...props} />, mountNode); if (process.env.NODE_ENV === 'production') { // avoid offline in dev mode because it's harder to debug - const OfflinePluginRuntime = require('offline-plugin/runtime'); - const WebPushSubscription = require('./web_push_subscription'); - OfflinePluginRuntime.install(); WebPushSubscription.register(); } |