next.js: Examples updated to v3.0.3 don't work in IE 11

I’d like to use the static page export feature of Next.js v3.0.3 however when I test in IE 11, a syntax error in the main.js file kills all JavaScript.

You can reproduce this issue with the following:

git clone https://github.com/zeit/next.js.git
cd next.js/examples/data-fetch
yarn install
yarn add next@3.0.3
yarn run dev

Any advice on how to get Next.js v3 with IE 11 working would be great.

About this issue

  • Original URL
  • State: closed
  • Created 9 years ago
  • Reactions: 6
  • Comments: 27 (13 by maintainers)

Commits related to this issue

Most upvoted comments

Yeah would be nice to re-open this as we just hit it today on Next 4.1.3 (only in dev though).

screen shot 2017-11-01 at 16 08 23

It was fine yesterday so not sure what happened to trigger this…

v 4.1.0 In IE 11 Error.

The object does not support the "from" property or method
The TypeError: object does not support the "from" property or method
At _toConsumableArray (http://127.0.0.1:3000/_next/1508422415649/main.js:13836:169)
At Anonymous function (http://127.0.0.1:3000/_next/1508422415649/main.js:13896:9)
At instantiate (http://127.0.0.1:3000/_next/1508422415649/main.js:13894:8)
At Unknown (Function code:2:10)
At mountIndeterminateComponent (http://127.0.0.1:3000/_next/1508422415649/commons.js:10406:7)
At beginWork (http://127.0.0.1:3000/_next/1508422415649/commons.js:10607:9)
At performUnitOfWork (http://127.0.0.1:3000/_next/1508422415649/commons.js:12579:5)
At workLoop (http://127.0.0.1:3000/_next/1508422415649/commons.js:12688:11)
At callCallback (http://127.0.0.1:3000/_next/1508422415649/commons.js:1305:9)
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }

@timneutkens I believe this is due to https://github.com/zeit/next.js/pull/2325. Probably requires a PR to downgrade strip-ansi similar to what was done in https://github.com/facebookincubator/create-react-app/pull/2692, if it doesn’t break anything in order to keep things working in dev for IE11.

I’m having the exact same issue, actually had it with “^3.0.1-beta.18” also.

Looks like the Babel + Webpack combo isn’t downgrading the JavaScript in the 2 dependencies chalk/ansi-regex and chalk/strip-ansi which are written using ES6 arrow functions. IE 11 is seeing the following code and throwing a syntax error.

"use strict";

const ansiRegex = __webpack_require__(314);

module.exports = input => typeof input === 'string' ? input.replace(ansiRegex(), '') : input;


/***/ }),
/* 314 */
/***/ (function(module, exports, __webpack_require__) {

"use strict";


module.exports = () => {
 const pattern = [
  '[\\u001B\\u009B][[\\]()#;?]*(?:(?:(?:[a-zA-Z\\d]*(?:;[a-zA-Z\\d]*)*)?\\u0007)',
  '(?:(?:\\d{1,4}(?:;\\d{0,4})*)?[\\dA-PRZcf-ntqry=><~]))'
 ].join('|');

 return new RegExp(pattern, 'g');
};


/***/ }),

I “think” this is the only section in the main.js file with ES6 code.

See the following screenshots:

screen shot 2017-08-09 at 9 33 32 pm screen shot 2017-08-09 at 9 40 08 pm

Thanks for the PR

Most packages by Sindre Sorhus are explicitly for recent Node environments only and not browsers, he closes a lot of issues relating to that as won’t-fix. Babel does not operate on node_modules, Webpack will add any ES6 syntax to the bundle as-is from an npm package.

It would be good to work out why these packages are included in the client bundle.