babel

Babel 7 Jest Core JS Typeerror wks is not a function

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: 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.<anonymous> (node_modules/core-js/modules/es6.symbol

Unexpected token import with Webpack and Babel

匿名 (未验证) 提交于 2019-12-03 01:07:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I added react-router v4 to my project with Webpack and NodeJS. The app compiled correctly without any error messages in the log, but the browser console gave me this: Uncaught SyntaxError: Unexpected token import at Object.<anonymous> (bundle.js:3391) at __webpack_require__ (bundle.js:556) at fn (bundle.js:87) at Object.eval (eval at <anonymous> (bundle.js:1405), <anonymous>:11:25) at Object.eval (eval at <anonymous> (bundle.js:1405), <anonymous>:24:27) at eval (eval at <anonymous> (bundle.js:1405), <anonymous>:25:30) at Object.<anonymous>

Appcelerator: [ERROR] Application Installer abnormal process termination. Process exit value was 1

匿名 (未验证) 提交于 2019-12-03 01:05:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I know this question has been asked lots of times, but answers given did not solve my problem so far. When trying to build an app to either a Android-device/-simulator/-package, Appcelerator comes with this error: [ERROR] Application Installer abnormal process termination. Process exit value was 1 I checked weither all Android-sdk's where installed correctly. In the terminal I did: appc logout -D / appc login I cleaned the project, including deleting Build- and Resources-folder by hand Ran: appc setup Some other terminal-lines I stumbled

Difference between Webpack/Babel and react-scripts

一曲冷凌霜 提交于 2019-12-03 00:59:40
Recently i started working on web pack and react-scripts and i would like to know the advantages and disadvantages using them and how they are different from each other. Oboo Chin Basically speaking, they serve different purposes and usually show up together. I will explain what they are designed to do. babel Babel is a transpiler. It can translate all kinds of high version ECMAScript ( not only ECMAScript, but it's easy to understand) into ES5, which is more widely supported by browsers (especially older versions). It's main job is to turn unsupported or cutting-edge language features into

Array.prototype.includes - not transformed with babel

匿名 (未验证) 提交于 2019-12-03 00:59:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I cannot figure out how to get this code to transform to compatible code in Node.js v4 env: [].includes('anything') Becuase this throws an error in Node.js v4 Error: includes is not a function... Can anyone help me understand why babel does not transform .includes() ? I have tried using babel-preset-es2015 and babel-preset-es2016 as well as the babel repl: Example babel repl code usage 回答1: You need to import babel-polyfill to use static methods like Array.from or Object.assign , instance methods like Array.prototype.includes . If you don't

Babel: Replacing ArrowFunctionExpression vs FunctionDeclaration in ExportDefaultDeclaration

匿名 (未验证) 提交于 2019-12-03 00:58:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Say I have the following code I want to transform: export default () => {}; The following visitor code works: export default function ({ types: t }) { return { visitor: { ArrowFunctionExpression(path) { if (!path.node.body.directives.some(d => d.value.value === 'inject')) return; path.node.body.directives = path.node.body.directives.filter(d => d.value.value !== 'inject'); path.replaceWith(t.arrayExpression([path.node])); } } }; } That results in the following output: export default [() => {}]; Great! Now change the input: export default

Running gunjs with Reactjs and webpack throws Reference Error in console

匿名 (未验证) 提交于 2019-12-03 00:57:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to install gun.js and run it inside a Reactjs webpack bundled app var path = require('path'), webpack = require('webpack'); module.exports = { devtool: 'source-map', target: 'node', node: { fs: 'empty' }, entry: { workboard: './src/workboard/main.js' }, output: { path: __dirname, filename: '/public/[name]/js/bundle.js' }, module: { loaders: [ { test: /.js?$/, loader: 'babel-loader', exclude: /node_modules/, query: { presets: ['es2015', 'react', 'stage-2', 'stage-1'] } } ], noParse: [/aws-sdk/] }, plugins: [ new webpack

travis cannot build because Error: Cannot find module &#039;react-test-renderer/shallow&#039;

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: The npm run test works fine locally. However , travis insists that the build is failed and it shows the following log : react-test-renderer is an implicit dependency in order to support react@15.5+. Please add the appropriate version to your devDependencies. See https://github.com/airbnb/enzyme#installation No coverage information was collected, exit without writing coverage information /home/travis/build/abdennour/react-csv/node_modules/enzyme/build/react-compat.js:159 throw e; ^ Error: Cannot find module 'react-test-renderer/shallow' at

webpack babel es7 async function error “TypeError: (0 , _typeof3.default) is not a function”

匿名 (未验证) 提交于 2019-12-03 00:53:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to require in api.js, but receiving the error "TypeError: (0 , _typeof3.default) is not a function". Attempting to debug this issue shows that removing "async" word makes the error disappear but I'm trying to use async. I have all the babel async plugins installed, defined in package.json and included in the plugins of webpack.config.js and .babelrc. Please help. my api.js let config = require('config'), $ = require('jquery') module.exports = { loggedIn: false, api: async (endpoint, params={}, method="GET") => { console.log

Using React-file-viewer

匿名 (未验证) 提交于 2019-12-03 00:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to use React-file-viewer. Npm tutorial is here But I have an error in the console : "you may need an appropriate loader to handle this file type" This is my code : import FileViewer from 'react-file-viewer'; import { CustomErrorComponent } from 'custom-error'; const file = 'http://example.com/image.png' const type = 'png' onError = (e) => { logger.logError(e, 'error in file-viewer'); } <FileViewer fileType={type} filePath={file} errorComponent={CustomErrorComponent} onError={this.onError}/> I specify, i have babel-preset-es2015