Using React Spring with older browsers

SyntaxError: Unexpected keyword ‘const’. Const declarations are not supported in strict mode.

ES6 syntax in the bundle, coming from React Spring

The library comes as an es-module compiled for evergreen browsers with the following browserlist config: >1%, not dead, not ie 11, not op_mini all. If you need to support legacy targets or deal with targets that don't support modules, you can use the commonJS export by simply appending .cjs to your imports.

How I managed to solve the issue

exclude: /node_modules\/(?!react-spring)/

Module not found: Error: Can’t resolve ‘source-map-loader’
Parsed request is a module

The new babel.config.js file

TypeError: Object.entries is not a function. (In ‘Object.entries(o)’, ‘Object.entries’ is undefined)

import 'core-js';

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store