babeljs

How to handle 'code generator has deoptimised styling' message from gulp-babel

这一生的挚爱 提交于 2020-01-01 03:12:07
问题 I've just employed gulp-babel to my gulp file with the following var babel = require('gulp-babel'); return gulp.src(files.concat.js.myModule) .pipe(babel()) .pipe(concat('myModule.js')) .pipe(gulp.dest('path/to/js')); ...and I get the following Note about deoptimising the styling in my gulp output: NOTE: The code generator has deoptimised the styling ... as it exceeds the max of "100KB" Is this a problem? Should I be handling this is some way? 回答1: Turns out the compact option is set to auto

Running Mocha tests compiled with Babel in Visual Studio Code

佐手、 提交于 2020-01-01 02:41:11
问题 I am using Babel in my Mocha tests. To run the test in terminal I use following command: mocha --debug --compilers js:babel/register Then I can use VS Code "Attach" debugging option to attach to the test process. I can set breakpoints and it stops, but because original code is in ES6 VS Code gets confused about line numbers and such. Is there anyway to make VS Code work with this setup? My "Attach" config: { "name": "Attach", "type": "node", // TCP/IP address. Default is "localhost". "address

External source maps for minified, transpiled ES6 code with webpack and gulp

谁说我不能喝 提交于 2019-12-31 17:55:14
问题 I'm writing ES6 code and transpile it to ES5 with Babel, then minify with Uglify. All run with webpack via gulp. I would like to use external source maps (to keep filesize as small as possible). The gulp task is pretty basic - all the funky stuff is in the webpack config: var gulp = require("gulp"); var webpack = require("gulp-webpack"); gulp.task("js:es6", function () { return gulp.src(path.join(__dirname, "PTH", "TO", "SRC", "index.js")) .pipe(webpack(require("./webpack.config.js"))) .pipe

ES7 async await functions with babel-loader not working

泪湿孤枕 提交于 2019-12-31 01:11:12
问题 I'm trying to run async await functions in JavaScript using the babel-loader of webpack. I'm using the following configuration: { name: 'client', context: path.join(__dirname, 'src', 'static', 'scripts'), entry: { index: './index.js' }, output: { path: path.join(__dirname, 'src', 'static', 'bundles'), filename: '[name].js' }, module: { loaders: [ { test: /\.js$/, loader: 'babel', query: { presets: ['es2015', 'stage-0'] } } ] }, resolve: { root: path.join(__dirname), fallback: path.join(_

Import React from 'react' results in Uncaught SyntaxError: Unexpected identifier

旧时模样 提交于 2019-12-30 18:04:05
问题 I've installed webpack 3 along with babel and my entry index.js/bundle.js will build and run, which I've tested with ES7/8 features, however imports won't work and result in Uncaught SyntaxError: Unexpected identifier . I've tried putting the babel config in the package.json as well as in a separate .babelrc file in my app root directory but I still get the error when trying to import. Am I missing a package or setting? index.js (works) // does not work // import React from 'react' // works

How to use both 'gulp-babel' and 'gulp-browserify'

独自空忆成欢 提交于 2019-12-30 08:15:59
问题 I try to write these code gulp.task('script', function() { 'use strict' return gulp.src(['app.js', 'components/**/*.jsx']) .pipe(babel()) .pipe(browserify()) .pipe(gulp.dest("dist")); }); but it shows some error: SyntaxError: /Users/Zizy/Programming/learn-react-js/components/CommentBox.jsx:58 <div className="commentBox"> ^ ParseError: Unexpected token at wrapWithPluginError (/Users/Zizy/Programming/learn-react-js/node_modules/gulp-browserify/index.js:44:10) It seems that before .pipe

Error with 'babel-runtime' while trying to serve a Meteor app

こ雲淡風輕ζ 提交于 2019-12-30 07:13:26
问题 I have recently been getting off the ground with Meteor and React. I followed the tutorial on the Meteor website with no problem. Then I tried creating another project, trying to follow another tutorial (for an older version of Meteor). Somewhere along the line, Meteor started throwing up obscure errors. After trying to start fresh again, I ended up reinstalling Meteor and it stopped complaining. However, I'm getting the same problems, again. Specifically, after creating a brand new project:

Error with 'babel-runtime' while trying to serve a Meteor app

我的未来我决定 提交于 2019-12-30 07:13:25
问题 I have recently been getting off the ground with Meteor and React. I followed the tutorial on the Meteor website with no problem. Then I tried creating another project, trying to follow another tutorial (for an older version of Meteor). Somewhere along the line, Meteor started throwing up obscure errors. After trying to start fresh again, I ended up reinstalling Meteor and it stopped complaining. However, I'm getting the same problems, again. Specifically, after creating a brand new project:

Exporting a class with Webpack and Babel not working

夙愿已清 提交于 2019-12-30 03:13:09
问题 I have a very simple setup with Webpack and Babel for a small library. Before, I had the following architecture to generate a ES5 version of the library: module.exports.lib = (function () { /* private part of library here */ return { ... /* public part of library here */ } })(); Everything is working fine this way, and I even had some ES6 features such as arrow functions inside my library and everything worked. However, I decided to change my approach to a ES6 class, this way: export default

New react-native app has 'TypeError: babelHelpers.typeof is not a function' [iOS]

女生的网名这么多〃 提交于 2019-12-30 02:43:47
问题 A new project created with the latest version of react-native throws javascript error while running(/debugging). Tested this on simulator. [fatal][tid:main] TypeError: babelHelpers.typeof is not a function. (In 'babelHelpers.typeof(target)', 'babelHelpers.typeof' is undefined) Installed the react-native client today & created the app using react-native init AwesomeProject App version: react-native-cli: 0.1.10 react-native: 0.20.0 node version: v5.6.0 回答1: Here's a comment explaining the issue