Questions tagged [babel-polyfill]

Babel Polyfill will emulate a full ES6 environment. This polyfill is automatically loaded when using babel-node.

Installation:

$ npm install babel-polyfill

To find more information :

265 questions
4
votes
1 answer

What are the ES6 features that babel cannot compile to ES5 while building?

I am unable to find a defined set of features that Babel compiler cannot compile. I know that there is babel-polyfill and core.js but I need to know the exact names of es2015 features which babel compiler cannot compile. Any help would be…
Vineet 'DEVIN' Dev
  • 1,183
  • 1
  • 10
  • 35
4
votes
2 answers

Chrome: `fetch` takes too long

Update: I changed the API from fetch to XMLHttpRequest and I still see the problem. According to the console logs the delay is between "readyState 1"(i.e. OPENED) and "readyState 2"(i.e HEADERS_RECEIVED). Also, maybe it is worth mentioning, that in…
user6307701
3
votes
1 answer

Force Webpack to use ES6 syntax in react-app bundle

My aim would be to have ES6 syntax (or latest one) in my entire react-app built. I've already managed to avoid polyfills in my own code by omitting some babel dependencies (such as @babel/preset-env). My bundled file does however hold, by most part,…
Thomas
  • 147
  • 10
3
votes
0 answers

Why does `@babel/transform-runtime` not polyfill `string.replace` for Edge 18?

From the Babel docs, it seems I can polyfill my code using either @babel/preset-env or @babel/transform-runtime in my babel config file. @babel/preset-env with useBuiltIns: usage will add a polyfill for string.replace when my targeted list of…
Bernard Leech
  • 756
  • 7
  • 14
3
votes
1 answer

How do I transfer polyfills to an iframe?

I'm making a website compatible with ie11. I use babel to transpile the code and then I run a script in index.html that checks what needs to be polyfilled and import each polyfill dynamically. In one part of my code, I have an iframe. The iframe…
3
votes
0 answers

How to avoid warning `Module parse failed: Unexpected token` comes from date-fns/locale

I'm using date-fns in my react application. When building the app with Webpack(4) and babel(7) Below warning appears. WARNING in ./node_modules/date-fns/locale/en/index.d.ts 1:8 Module parse failed: Unexpected token (1:8) You may need an…
mr93
  • 123
  • 2
  • 9
3
votes
1 answer

What is the risk of global polyfills in an external script breaking the functionality of a website?

The documentation for @babel/polyfill has the following note: If you are looking for something that won't modify globals to be used in a tool/library, checkout the transform-runtime plugin. On the transform-runtime documentation, it says the…
flut1
  • 195
  • 1
  • 10
3
votes
4 answers

Loading React Native: UnhandledPromiseRejectionWarning: Error: Cannot find module 'View'

I'm trying to contribute to a testing library. The library should provide a wrapper for react-test-renderer like react-native-testing-library does. In order to see if my code worked I wrote a simple unit test using the code I wrote for the library.…
J. Hesters
  • 13,117
  • 31
  • 133
  • 249
3
votes
1 answer

IE11 SCRIPT1002 syntax error with => in main.js babel and webpack

I am getting error SCRIPT1002 syntax error in IE11 with ES6 and Babel. I found that it is due to arrow function => in my typescript code. I am using Vue webpack: "^4.20.2", @babel/core: "^7.1.2"` I've tried following .babelrc { "presets": [ …
3
votes
2 answers

Object doesn't support property or method 'scrollBy' in IE11 in React

I am using the following code to scroll scroll an element on mouseDown, and stop scrolling on mouseUp/mouseOut. scrubby(xDir) { let dub = setInterval(() => { document.getElementById("chart").scrollBy(8 * xDir, 0); }, 10); …
Finglish
  • 9,692
  • 14
  • 70
  • 114
3
votes
2 answers

Page created with ReactJs is not indexed by google

I have a news section created with ReactJs, each news post acts as an individual page. Unfortunately Google is not indexing these pages because of REactJs. I tried to use the babel-polyfill webpack, but it's still not working. Also, I'm making my…
3
votes
2 answers

react with IE11 is not working, displaying blank screen

when trying to load application in IE11 it just shows blank screen and errors with syntax error on this line class App extends __WEBPACK_IMPORTED_MODULE_0_react__["Component"] { my package.json { "name": "ccp-react", "version": "1.0.0", …
shorif2000
  • 2,582
  • 12
  • 65
  • 137
3
votes
0 answers

Use babel-polyfill inside phantomjs

How can i use babel-polyfill inside phantomjs to get some es6 futures? I have phantomjs 2.1.1, and babel-polyfill installed (via npm install babel-polyfill). Here is file main.js: require('babel-polyfill'); console.log(String.startsWith); When i…
diralik
  • 6,391
  • 3
  • 28
  • 52
3
votes
2 answers

ReferenceError: global is not defined at eval

I'm experiencing an error that I believe is from webpack's side. Here it is: index.js:9 Uncaught ReferenceError: global is not defined at eval (index.js:9) at Object. (bundle.js:2548) at __webpack_require__ (bundle.js:622) …
adambargh
  • 119
  • 1
  • 5
  • 11
3
votes
1 answer

Uncaught ReferenceError: global is not defined at eval

I'm experiencing an error that I believe is from webpack's side. Here it is: index.js:9 Uncaught ReferenceError: global is not defined at eval (index.js:9) at Object. (bundle.js:2548) at __webpack_require__ (bundle.js:622) …
adambargh
  • 119
  • 1
  • 5
  • 11