I'm trying to transpile jsx using gulp and gulp-bro, and I'm nearly there except it fails to import components unless I add .jsx to the end of the import. Like this:
import Viewer from './components/viewer/Viewer';
Fails with Error: Cannot find module './components/viewer/Viewer'
While:
import Viewer from './components/viewer/Viewer.jsx';
Works fine!
Of course the tree of imports is a lot more involved than this, so I'd rather avoid renaming everything to .js or explicitly specifying .jsx if I can avoid it.
Here's the relevant section of my gulpfile. It's ignoring the extensions setting.
gulp.task('viewer', function () {
gulp.src('./app/js/app.jsx')
.pipe(bro({
transform: [
babelify.configure({
presets: ['env', 'react'],
})
],
extensions: ['js', 'jsx'],
debug: true,
}))
.pipe(rename('app.js'))
.pipe(gulp.dest(paths.js))
});