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.

ES6 syntax in polyfilled ES5 code

See original GitHub issue
  1. What version of RJEA are you using (react-json-editor-ajrm version)? ^2.5.6
  2. What operating system and processor architecture are you using? MacOS Intel Core i5
  3. What did you do? Just tried to use (pollyfilled ES5 version as document here) the library to render a JSON field in a form. While it works in local env, it does not build because of Uglify plugin in our webpack config.
  4. What did you expect to see? As we are using the polyfilled ES5 version of the library, it should not produce the ES6 syntax which seems to be issue here.
  5. What did you see instead? Our app does not build because of the following error:
ERROR in main.63a5ae5adba0235e52d9.js from UglifyJs
Unexpected token: name (JSONInput) [main.63a5ae5adba0235e52d9.js:95191,6]

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

10reactions
napalm272commented, Feb 14, 2019

I just encountered the same issue. Instead of importing ‘react-json-editor-ajrm’, you can import ‘react-json-editor-ajrm/index’ as a workaround. There seems to be an issue when you npm install this package. The module field in the installed package.json is ./es/index.js instead of index.js, so if you do import ‘react-json-editor-ajrm’ you are actually importing the es version

0reactions
shpsicommented, May 20, 2019

@napalm272 thanks worked for me too!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Polyfills and transpilers - The Modern JavaScript Tutorial
A transpiler is a special piece of software that translates source code to another source code. It can parse (“read and understand”) modern...
Read more >
es6-articles/50 - Polyfilling ES6 for Older Browsers.md at master
We just learned that Babel takes our ES6 code and compiles it down to ES5 code, ... Babel only works on syntax, meaning...
Read more >
Javascript: ES6+ to ES5 with Babel - Byteridge
Transform syntax, Polyfill features that are missing in your target environment (through @babel/polyfill); Source code transformations ...
Read more >
Can I target ES6 with Typescript if I am using babel-polyfill?
Does babel-polyfill provide the same level of ES5 support as transpiling to an ES5 target? No. babel-polyfill adds missing ES6 runtime ...
Read more >
ES5 vs ES6 ( With example code ). We have came so far
Arrow functions brought a lot of clarity & code reduction to… ... and importing module syntax changed completely with the introduction of ES6...
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