babel

How to configure Jest to work with Expo SDK 32

会有一股神秘感。 提交于 2019-12-13 16:45:06
问题 I have an Expo app and was using SDK 28. My team decided we should update to the latest version, that meant updating React Native (Since the latest SDK uses RN 0.57) and Babel. When we updated our dependencies, and fixed our config files, Jest started to give us this error: TypeError: Cannot read property 'fetch' of undefined at node_modules/react-native/Libraries/vendor/core/whatwg-fetch.js:6:12 at Object.<anonymous> (node_modules/react-native/Libraries/vendor/core/whatwg-fetch.js:486:3) at

How to create your own babel processor alternative to `React`

删除回忆录丶 提交于 2019-12-13 16:40:44
问题 When you use JSX in a JS file, you have to import React or else the generated code won't compile. This is because this: import React from 'react' import ReactDOM from 'react-dom' function Foo() { return 'hello world' } ReactDOM.render(<Foo/>, document.body) Becomes: import React from 'react' import ReactDOM from 'react-dom' function Foo() { return 'hello world' } ReactDOM.render(React.createElement(Foo), document.body) So the React in React.createElement is getting generated by some babel or

How to configure my Python 2.7 to use the correct Babel installation on my OSX Mavericks system?

大兔子大兔子 提交于 2019-12-13 06:23:21
问题 This is the follow up on my previous question. I have an OSX Mavericks machine where I installed Python 2.7 and Babel 1.3 using MacPorts. The problem is that it seems I have at least two versions of babel on that machine and except for the one I installed using MacPort, the other does not have the CLDR locale data files installed, so when I execute the following command in my application directory : pybabel extract -o ./locale/messages.pot ./ I get this error message : [...] writing PO

React Native JS bundle crashes on iOS Release, Babel not working?

故事扮演 提交于 2019-12-13 04:37:01
问题 My React Native build compiles in Debug and runs fine, but when I run my Release scheme the spread operators are throwing errors, causing the build to crash. Specifically, the first error thrown is from a spread operator in the NativeBase library. For reference, my .babelrc is here: { "presets": ["stage-3", "react-native"], "plugins": [ "transform-es2015-destructuring", "transform-object-rest-spread", "syntax-object-rest-spread", [ "import", { "libraryName": "antd-mobile", "style": true } ] ]

what is this code case 6:case “end”:return _context15.stop() babel react-redux webpack in devtools

[亡魂溺海] 提交于 2019-12-13 03:56:22
问题 In my react-redux application, i have used many libraries especially babel 6.4.1 which i could not upgrade it, webpack 4, polyfill and hundreds of other libraries, anyway; At the lates state i am calling an api in front-end and api returning true result for a method but i have seen extra codes after the methods in chrome webpack dev-tools sources. Which effecting my codes and application does not run stable for this reason. I have researched all google but couldn't understand why? My function

Now.sh build breaking due to: Support for the experimental syntax 'decorators-legacy' isn't currently enabled

大城市里の小女人 提交于 2019-12-13 03:55:56
问题 Expected: After adding decko (Support for decorators) as well as adding support for experimetalDecoractors in my tsconfig.js and using @babel/plugin-proposal-decorators in package.json . My now.sh build should build and deploy fine after creating a PR, also since the app is running perfectly locally. Results: The build actually breaks with the following error: Support for the experimental syntax 'decorators-legacy' isn't currently enabled PR: https://github.com/Futuratum/moonholdings.io/pull

How to export global variable from browserify/babelify to be used in project without browserify?

空扰寡人 提交于 2019-12-13 02:27:37
问题 Scenario: I have 2 projects with quite different setup: Regular website, legacy code with simple gulp setup Small pet project. JS slider plugin written with help of ES6 classes (transpiled with babel). JS gulp task: gulp.task('js', function() { return gulp.src('src/scripts/*.js') .pipe($.plumber()) .pipe(through2.obj(function (file, enc, next) { browserify(file.path, { debug: true }) .transform(require('babelify')) .transform(require('debowerify')) .bundle(function (err, res) { if (err) {

webpack创建Vue项目

怎甘沉沦 提交于 2019-12-13 01:13:32
webpack创建Vue项目 总结 第一步 创建自己的项目目录 在项目目录中init出自己的package.json文件 npm init (npm init -y) -y的结果是不用敲enter一路选择默认的值 第二步 安装webpack 命令 npm install webpack --save-dev 安装webpack-cli 命令 npm install webpack-cli --save-dev 安装第三方的框架 清除dist文件夹重新产生的dist文件的框架 (clean-webpack-plugin) 命令 npm install clean-webpack-plugin --save-dev 生成html文件的框架(html-webpack-plugin) 命令 npm install html-webpack-plugin --save-dev es6转译es5的依赖 babel npm i @babel/core babel-loader @babel/preset-env @babel/plugin-transform-runtime --save-dev babel的运行环境 命令 npm i @babel/polyfill @babel/runtime --save 在项目的根目录中创建.babelrc文件 再文件中写入 { "presets" : [

Auto reload react server on update

廉价感情. 提交于 2019-12-13 00:03:21
问题 I'm new to React. I'm having some problems with react server. After starting the server by npm start if I work on the source code and make some changes, I have to stop the server and restart it to make that change available on the browser. Is there anyway to make it auto compile and refresh the browser on update ? (Like nodemon for node ?) 回答1: I had a similar (or event the same) problem and I changed starting command in the package.json file by adding following flags: --watch --watch-poll to

Unable to expose a component library in react with webpack and babel

旧街凉风 提交于 2019-12-12 16:40:58
问题 I'm creating a small component library for react. Something that can be required like var Components = require('components') . This will have individual components, much like react-bootstrap does. I'm trying to use webpack with babel to compile this into an index.js file. The compilation went well. I published this to my local npm registry and installed it in one of my other projects. When I require it - require('components') - the require returns an empty object. Below is my folder structure