Answer the question
In order to leave comments, you need to log in
Import not working in Gulp-Babel, what's wrong?
Hello!
Please help, I'm facing the following problem. It seems that everything is set up correctly, but Gulp stubbornly refuses to work with imports for some reason.
This is what part of the build system looks like:
package.json :
{
"devDependencies": {
"babel-preset-es2015": "6.6.0",
"babel-preset-react": "6.5.0",
"gulp": "3.9.1",
"gulp-babel": "6.1.2",
"gulp-uglify": "1.5.3",
"react": "0.14.8",
"react-dom": "0.14.8"
}
}
const babel = require('gulp-babel');
const gulp = require('gulp');
const uglify = require('gulp-uglify');
gulp.task('js', function () {
gulp.src('src/js/App.js')
.pipe(babel())
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
{
"presets": ["es2015", "react"]
}
import React from 'react'
import ReactDOM from 'react-dom'
import App from './Main.js'
ReactDOM.render(<Main />, document.body);
node_modules
and the Main.js file located in the same directory as App.js. import React from 'react'
export default class Main extends React.Component {
render() {
return (
<div>
<h1>Hello!</h1>
</div>
);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question