From 0ff5926ae9a5b3706d91c47a7e9c4feef36989dd Mon Sep 17 00:00:00 2001 From: Jan Bauer Nielsen Date: Wed, 27 Jun 2018 12:07:53 +0200 Subject: [PATCH] Ensure compatibility with Internet Explorer We need to include babel-polyfill in our application as older versions of Internet Explorer are not capable of the latest EcmaScript features and functionality. https://github.com/facebook/react/issues/8379 https://babeljs.io/docs/en/babel-polyfill.html --- package.json | 1 + src/main.js | 1 + webpack.common.js | 5 ++++- yarn.lock | 2 +- 4 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 27e7b15..f4033ce 100644 --- a/package.json +++ b/package.json @@ -9,6 +9,7 @@ "test": "node_modules/.bin/mocha --require babel-core/register --recursive" }, "dependencies": { + "babel-polyfill": "6.26.0", "body-parser": "1.18.2", "busboy": "0.2.14", "express": "4.16.2", diff --git a/src/main.js b/src/main.js index 8a63cb9..665b29f 100644 --- a/src/main.js +++ b/src/main.js @@ -3,6 +3,7 @@ * See license text in LICENSE.txt or at https://opensource.dbc.dk/licenses/gpl-3.0/ */ +import "babel-polyfill"; import React from "react"; import ReactDOM from "react-dom"; diff --git a/webpack.common.js b/webpack.common.js index e0cefb8..4ade5ea 100644 --- a/webpack.common.js +++ b/webpack.common.js @@ -6,7 +6,10 @@ const path = require("path"); module.exports = { - entry: path.resolve(__dirname, "src", "main.js"), + entry: [ + 'babel-polyfill', + path.resolve(__dirname, "src", "main.js") + ], output: { path: path.resolve(__dirname, "src", "static", "js"), filename: "bundle.js" diff --git a/yarn.lock b/yarn.lock index 67a285e..cbd95c6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -606,7 +606,7 @@ babel-plugin-transform-strict-mode@^6.24.1: babel-runtime "^6.22.0" babel-types "^6.24.1" -babel-polyfill@^6.26.0: +babel-polyfill@6.26.0, babel-polyfill@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-polyfill/-/babel-polyfill-6.26.0.tgz#379937abc67d7895970adc621f284cd966cf2153" dependencies: