babel-polyfill

React-Native 0.57: 'Can't find variable: require' with metro-react-native-babel-preset

↘锁芯ラ 提交于 2019-12-12 10:07:37
问题 I started a multiplatform project with code sharing between react-native and react-js. So I have a webpack setup for browser/Electron, and a react-native 0.57 setup for Android/iOS. The problem I'm having right now is the following: Can't find variable: require It might be a very bald question, but do I need anything else? I read, that React-native should support require by itself, but couldn't find anything related to this setup yet. .babelrc {"presets": ["module:metro-react-native-babel

Only one instance of babel-polyfill is allowed

别来无恙 提交于 2019-12-11 23:22:42
问题 I am getting the following error Uncaught Error: only one instance of babel-polyfill is allowed at Object.eval (index.js?db4d:10) at eval (index.js:29) at Object../node_modules/babel-polyfill/lib/index.js (vendors.js?3b19ee46035be2acbd36:310) at __webpack_require__ (vendor.js?3b19ee46035be2acbd36:79) at Object.4 (vendor.js?3b19ee46035be2acbd36:165) at __webpack_require__ (vendor.js?3b19ee46035be2acbd36:79) at checkDeferredModules (vendor.js?3b19ee46035be2acbd36:46) at vendor.js

Babel 7 Jest Core JS Typeerror wks is not a function

六月ゝ 毕业季﹏ 提交于 2019-12-11 17:50:41
问题 After upgrading my project to Babel 7, running tests through jest is throwing the following error. The tests used to run without any issues in Babel 6, but are failing in Babel 7 with the following error TypeError: wks is not a function at Object.<anonymous>.module.exports (node_modules/core-js/modules/_fix-re-wks.js:16:16) at Object.<anonymous> (node_modules/core-js/modules/es6.regexp.replace.js:4:25) at Object.<anonymous> (node_modules/core-js/modules/es6.regexp.split.js:3:1) at Object.

Uncaught Error: only one instance of babel-polyfill is allowed error on production

我们两清 提交于 2019-12-11 16:57:34
问题 I tried all the potential solutions but they did not work. What happens if I have babel-polyfill error on production. Some browsers do not work? 📷 I am currently using react-loadable to create chunks by page. After that I am getting babel-polyfill error. webpack.prod.js entry: ['babel-polyfill', path.resolve(CWD, './react/containers/root/root.prod.js')], .babelrc { "presets":[ "react", "es2015", "stage-2" ], "plugins":[ "react-loadable/babel", "syntax-dynamic-import", "dynamic-import-node", [

Vue CLI 3 + Vuetify - Not working on IE 11 (Babel does not transpile?)

萝らか妹 提交于 2019-12-10 15:23:53
问题 I’m using Vue CLI 3 with Vuetify for my project. It works well on Chrome and iOS 12, but it shows blank page on IE11 and iOS Safari < 12. The console in IE11 shows: SCRIPT1003: Expected ':' I think it’s because Babel does not transpile the ES6 syntax (arrow function, spread, etc) to ES5 syntax. I still see it in the compiled code after running yarn build. Here is my babel.config.js: //bable.config.js module.exports = { presets: [ [ '@vue/app', { useBuiltIns: 'entry' }] ] } Here is my

react with IE11 is not working, displaying blank screen

大城市里の小女人 提交于 2019-12-07 15:46:29
问题 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", "license": "MIT", "scripts": { "start": "webpack-dev-server", "build": "webpack" }, "private": true, "dependencies": { "babel-plugin-lodash": "^3.3.2", "babel-preset-es2015": "^6.24.1", "babel-preset-react-optimize": "^1.0.1", "babel-preset-stage-1": "^6.24.1"

react with IE11 is not working, displaying blank screen

为君一笑 提交于 2019-12-06 04:50:58
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", "license": "MIT", "scripts": { "start": "webpack-dev-server", "build": "webpack" }, "private": true, "dependencies": { "babel-plugin-lodash": "^3.3.2", "babel-preset-es2015": "^6.24.1", "babel-preset-react-optimize": "^1.0.1", "babel-preset-stage-1": "^6.24.1", "bootstrap": "^3.3.7", "classnames": "^2.2.5", "create-react-class": "^15.6.2", "cross-env": "^5.1.3"

React-Native 0.57: 'Can't find variable: require' with metro-react-native-babel-preset

半城伤御伤魂 提交于 2019-12-06 04:36:13
I started a multiplatform project with code sharing between react-native and react-js. So I have a webpack setup for browser/Electron, and a react-native 0.57 setup for Android/iOS. The problem I'm having right now is the following: Can't find variable: require It might be a very bald question, but do I need anything else? I read, that React-native should support require by itself, but couldn't find anything related to this setup yet. .babelrc {"presets": ["module:metro-react-native-babel-preset"]} I'm also using @babel/polyfill and @babel/runtime on browser side, but I wonder if they would

How do I use babel's `useBuiltIns: 'usage'` option on the vendors bundle?

给你一囗甜甜゛ 提交于 2019-12-03 00:49:21
Since I need to support also IE11, I need to transpile also node_modules . This is the babel config I use on the node_modules: presets: [ ['@babel/preset-env', { modules: false, useBuiltIns: 'usage' }], ], I use the useBuiltIns options because it was giving an error Symbol is not defined , the polyfill was needed. However this configuration breaks at compile time, supposedly because it injects some imports in the code, here is the error: Basically it's not liking the module.exports . So how do I use useBuiltIns in the vendors bundle? For now I solved by always requiring the babel polyfill in

babel vs babel-core vs babel-loader vs babel-preset-2015 vs babel-preset-react vs babel-polyfill

徘徊边缘 提交于 2019-11-29 23:36:27
I was setting up Webpack for my React project and got confused between babel , babel-core , babel-loader , babel-preset-2015 and babel-preset-react . I know that Babel is needed to transform ES7 or ES6 code to ES5 but in my package.json I have installed all these dependencies except Babel and they also as devDependencies . Can someone please explain what's the difference between all these and why all of them are needed for my project? Isn't there any single dependency to replace them all? And if they are so important, why are they included as devDependencies ? babel Babel doesn't do anything