T
T
toly192017-05-30 17:08:37
JavaScript
toly19, 2017-05-30 17:08:37

How to speed up jsx to javascript conversion through gulp?

there is a Galpov task:

gulp.task("buildJSX", function () {
  return browserify({ entries: "./client/jsx/app.jsx", extensions: [".jsx"], debug: false })
    .transform("babelify", { presets: ["es2015", "react"] })
    .bundle()
    .pipe(source("bundle.js"))
    .pipe(gulp.dest("./server/gulpTemplate/js"));
});

Its execution:
Finished 'buildJSX' after 4.11 s
How can you speed up the conversion, otherwise you don’t want to constantly wait for 3-4 seconds.
Here are the variables:
let gulp = require("gulp"),
  browserify = require("browserify"),
  babelify = require("babelify"),
  source = require("vinyl-source-stream");

Answer the question

In order to leave comments, you need to log in

1 answer(s)
K
Konstantin Kitmanov, 2017-05-30
@k12th

In this form, it will always be slow, because everything is compiled from scratch. Use watchify ( for example ) - it watches for changes and caches compiled files.
Well, if the goal is to “learn react” or “quickly make an application in react”, and not “fuck with gallp and browser-fay”, then don’t suffer and take create-react-app .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question