question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Question: Configuring ES version that Babel outputs

See original GitHub issue

I was wondering how to configure Babel in the non-ejected package.json to work with older browsers? I’m seeing compatibility issues with CasperJS with a PhantomJS backend and also IE 11. Also I have been looking at the ejected webpack configuration files, is there somewhere within these files I should look to configure the output JavaScript version?

I’m somewhat new to a lot of the JavaScript build tools, so general advice would be helpful. I’d like to be able to use the react-scripts without ejecting as much as possible.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

6reactions
Jorjoncommented, Aug 17, 2018

One easy way to deal with this, is to polyfill everything if they run an old browser. Add this line inside your <head>:

<script nomodule src="https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js" integrity="sha256-WRc/eG3R84AverJv0zmqxAmdwQxstUpqkiE+avJ3WSo=" crossorigin="anonymous"></script>

Sure, it will be slower for old browsers, but as I said, this is super easy to do and has no impact on modern browsers, since the nomodule attribute makes the modern browser to skip that script.

2reactions
gaearoncommented, Feb 21, 2017

This code shouldn’t need Symbols, no. This is object spread ({...stuff}), not array spread ([...stuff]). Please raise an issue with React Bootstrap.

To add a Symbol polyfill alone, you can do:

import 'core-js/es6/symbol';

assuming you ran npm i --save core-js before.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is Babel? · Babel
Babel is a JavaScript compiler. Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version...
Read more >
How to configure Babel to only output es2017/modern code?
I've just found an answer by reading this code that comes from here. It's simply: 'last 2 Chrome versions', 'last 2 Safari versions', ......
Read more >
Configuring Babel 6 - 2ality
babel -core : the core compilation machinery and plugin infrastructure for Babel. You will rarely need to install this package, because other ...
Read more >
Setting Up a Babel Project - ECMAScript 6 Tutorial
Although there are other options, Babel has become the de-facto standard to compile ECMAScript 6 applications to a version of ECMAScript that can...
Read more >
A short and simple guide to Babel - Flavio Copes
Introduction to Babel; Installing Babel; An example Babel configuration ... if all this ES thing sounds confusing to you, see more about ES...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found