babel

Babel 6 CLI: Unexpected token export?

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to run Babel through it's CLI using babel-node but I keep getting the Unexpected token export error. I understand that Babel 6 is all about plugins and that I need to set the plugin through .babelrc but it doesn't seem to work properly. So here are my questions: Should I be using the syntax-export-extensions plugin ? I've also tried using the alternative method which is setting the plugin through package.json but still no luck. Also, does Babel 6's CLI have a global .babelrc option? It seems tedious if I have to install the

What does “The code generator has deoptimised the styling of [some file] as it exceeds the max of ”100KB“” mean?

匿名 (未验证) 提交于 2019-12-03 01:21:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I added a new npm package to my project and require it in one of my modules. Now I get this message from webpack, build modulesNote: The code generator has deoptimised the styling of "D:/path/to/project/node_modules/ramda/dist/ramda.js" as it exceeds the max of "100KB". What does it mean? Do I need to take some action? 回答1: This is related to compact option of Babel compiler, which commands to "not include superfluous whitespace characters and line terminators. When set to 'auto' compact is set to true on input sizes of >100KB." By default

how can I use babel polyfill to support all IE11 issues with gulp

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I've been piecing together support for IE11 by adding plugins for transform-object-assign and array-includes and now I'm getting a symbol error for using for of loops. Instead of just tackling them one at a time, is it possible for me to work babel polyfill into my build below and future proof it? I've read several related questions but still am not clear on how I'd fit babel-polyfill into the gulp build below: return gulp.src(input) // Grab the input files .pipe($.babel({ presets: ['es2015'], // transform ES6 to ES5 with Babel plugins: [

RegeneratorRuntime is not defined

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to run Karma-babel-preprocessor and a straight forward ES6 generator: //require('babel/polyfill'); describe("how Generators work", function() { it("will allow generator functions", function() { /*function * numbers() { yield 1; yield 2; yield 3; };*/ let numbers = { [Symbol.iterator]:function*(){ yield 1; yield 2; yield 3; } } let sum = 0; for(n of numbers){ sum += n; } expect(sum).toBe(6); }); }); From this I generated my test files (ES6 => ES5) with babel: babel src --watch --out-dir tests Then I run karma start I get error:

How to use jest with webpack?

匿名 (未验证) 提交于 2019-12-03 01:20:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I use webpack to develop a React component. Here is a simple version of it: 'use strict'; require('./MyComponent.less'); var React = require('react'); var MyComponent = React.createClass({ render() { return ( Hello World ); } }); module.exports = MyComponent; Now, I would like to test this component using jest . Here is the relevant bit from my package.json : "scripts": { "test": "jest" }, "jest": { "rootDir": ".", "testDirectoryName": "tests", "scriptPreprocessor": " /node_modules/babel-jest", "unmockedModulePathPatterns": [ "react" ] }

Flask-Babel not working on the login page

匿名 (未验证) 提交于 2019-12-03 01:19:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have a Flask/Dash app that uses the Flask-Babel module. The translation works like a charm after logging in and browsing through pages. However, I cannot make it work for the login page which will always be displayed in English. The messages.po and messages.mo both contain the translation strings I prepared for the login page, so the compilation part seems to work fine. Here's a snippet from my app.py (with a hard-coded choice of Spanish): import dash from dash . dependencies import Input , Output from flask import Flask ,

SCRIPT1002: Syntax error in IE11 with React + Babel + Webpack

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to get my React App with ES2015 functionalities running in IE >= 11 using Webpack + Babel. The setup is custom, using the inferno-compat layer, so no create-react-app used here. However - despite applying the latest babel-polyfill and babel-preset-env practices to my .babelrc and webpack config, I still get a SCRIPT1002: Syntax error within my bundle.js when trying to access the app with IE11. When I follow the syntax error reference in IEs console, this is the part within the generated bundle.js that's conflicting (the arrow

Reactjs: Unexpected token '<' Error

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i am just starting with Reactjs and was writing a simple component to display li tag and came across this error: Unexpected token ' I have put the example at jsbin below http://jsbin.com/UWOquRA/1/edit?html,js,console,output Please let me know what i am doing wrong. 回答1: UPDATE: In React 0.12+, the JSX pragma is no longer necessary. Make sure include the JSX pragma at the top of your files: /** @jsx React.DOM */ Without this line, the jsx binary and in-browser transformer will leave your files unchanged. 回答2: I solved it using type = "text

Unable to resolve module `@babel/runtime/helpers/interopRequireDefault`

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: When creating a new react native project using the standard react-native init MyApp and running react-native run-ios for the first time I'm seeing the following error error: bundling failed: Error: Unable to resolve module `@babel/runtime/helpers/interopRequireDefault` from `/Users/chrisedgington/Development/ReactNative/SixNationsPredictor/index.js`: Module `@babel/runtime/helpers/interopRequireDefault` does not exist in the Haste module map This might be related to https://github.com/facebook/react-native/issues/4968 To resolve try the

bundling failed: Error: Plugin 0 provided an invalid property of “default”

匿名 (未验证) 提交于 2019-12-03 01:10:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to run a react native app on my AVD using this command : react-native run-android but getting the following error: bundling failed: Error: Plugin 0 specified in "C:\\Users\\ASUS\\test\\node_modules\\babel-preset-react-native\\index.js" provided an invalid property of "default" (While processing preset: "C:\\Users\\ASUS\\test\\node_modules\\babel-preset-react-native\\index.js") at Plugin.init (C:\Users\ASUS\test\node_modules\babel-core\lib\transformation\plugin.js:131:13) at Function.normalisePlugin (C:\Users\ASUS\test\node_modules