Skip to content

Commit

Permalink
Enforce loading babel-polyfill first
Browse files Browse the repository at this point in the history
This is to avoid loading anything before loading the polyfill, otherwise
we risk loading dependencies (such as React) before it.

This was causing the compatibility page to fail somehow.

See facebook/react#8379

Fixes #6562
  • Loading branch information
lukebarnard1 committed Apr 27, 2018
1 parent 6b2c853 commit 9b05517
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 12 deletions.
12 changes: 0 additions & 12 deletions src/vector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,6 @@ limitations under the License.

'use strict';

// for ES6 stuff like startsWith() that Safari doesn't handle
// and babel doesn't do by default
// Note we use this, as well as the babel transform-runtime plugin
// since transform-runtime does not cover instance methods
// such as "foobar".includes("foo") which bits of our library
// code use, but the babel transform-runtime plugin allows the
// regenerator runtime to be injected early enough in the process
// (it can't be here as it's too late: the alternative is to put
// the babel-polyfill as the first 'entry' in the webpack config).
// https://babeljs.io/docs/plugins/transform-runtime/
require('babel-polyfill');

// Require common CSS here; this will make webpack process it into bundle.css.
// Our own CSS (which is themed) is imported via separate webpack entry points
// in webpack.config.js
Expand Down
5 changes: 5 additions & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@ if (!og_image_url) og_image_url = 'https://riot.im/app/themes/riot/img/logos/rio

module.exports = {
entry: {
main: [
// Load this first to avoid issues where some imports (namely react)
// potentially before babel-polyfill.
'babel-polyfill',
],
"bundle": "./src/vector/index.js",
"indexeddb-worker": "./src/vector/indexeddb-worker.js",

Expand Down

0 comments on commit 9b05517

Please sign in to comment.