Answer the question
In order to leave comments, you need to log in
Why doesn't plumber help catch gulp-jsx module error?
Developers, I have such a problem: I started learning react. And I decided to set up gulp for this business. Set up the gulp-jsx module to compile jsx to js. But the problem is, the code on jsfiddle.net works without errors, and when you try to run this jsx through gulp, it crashes due to an error. Can't catch the error. I'm trying to use gulp-plumber, but the plumbing still crashes when saving jsx. And with an error in other modules, the error is displayed normally. Now my jsx is processed like this:
gulp.task('jsx', function() {
gulp.src('./src/jsx/*.js')
.pipe(plumber())
.pipe(jsx({
factory: 'React.createElement'
}))
.pipe(concat('app.js'))
.pipe(gulp.dest('./build/js/'))
.pipe(reload({stream: true}));
});
Answer the question
In order to leave comments, you need to log in
It was not possible to catch the error using plumber(), but I went the other way: I created a cmd file to run gulp and added a command to output data to files. As a result, my errors were recorded in the log.err file.
cmd file content:
set OUTPUT="log"
if "%STDOUT_REDIRECTED%" == "" (
set STDOUT_REDIRECTED=yes
cmd.exe /c %0 %* >%OUTPUT%.std 2>%OUTPUT%.err
exit /b %ERRORLEVEL%
)
gulp
.pipe(babel({
plugins: ['transform-react-jsx']
}))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question