Quantcast
Channel: How convert .jsx to .js with Gulp and Babel? - Stack Overflow
Browsing all 6 articles
Browse latest View live

Answer by Waleed93 for How convert .jsx to .js with Gulp and Babel?

For latest React v16.8.x using Babel 7, use @babel/preset-env and @babel/preset-react modules.npm i -D @babel/preset-env @babel/preset-reactThen in your gulpfile.js:var gulp = require('gulp');var babel...

View Article



Answer by JFAP for How convert .jsx to .js with Gulp and Babel?

gulp.task('build', ['copy'], function() { gulp.src(['src/**/*.jsx','src/**/*.js','!./node_modules/**' ]) .pipe(babel({ presets: ['es2015', 'react'] })) .pipe(gulp.dest('app'));});since I am also using...

View Article

Answer by itacode for How convert .jsx to .js with Gulp and Babel?

In order to get displayName automatically inserted on transformation, you need to install gulp-babel and React preset:npm install --save-dev gulp-babel babel-preset-reactand then in the gulpfile.js:var...

View Article

Answer by Navid Farahzadi for How convert .jsx to .js with Gulp and Babel?

First you need to install these two packages:npm install gulp-babel babel-plugin-transform-react-jsxthen you can convert like this:var gulp = require('gulp');var babel =...

View Article

Answer by Robbie for How convert .jsx to .js with Gulp and Babel?

Yeah using gulp with the package gulp-babel would do the trick.https://github.com/babel/gulp-babel

View Article


How convert .jsx to .js with Gulp and Babel?

I need to convert all /src/.jsx files to /src/.jsBefore I used gulp-react:var react = require('gulp-react');gulp.task('jsx', function () { return gulp.src('src/jsx/*.jsx') .pipe(react())...

View Article
Browsing all 6 articles
Browse latest View live


Latest Images