I'm importing a css in my jsx, and using gulp with browserify and babelify. Somehow I'm getting this error: error screenshot
I have the following jsx which imports a css:
import '../../css/app.css';
function Square(props) {
return (
<button className="squares" onClick={props.onClick}>
{props.value}
</button>
);
} ...
Then I have this in my gulp file:
var bundler = watchify(browserify(files[i], {
debug : true
}).transform(babelify, {
ignore : /\.([json]|[css])$/,
presets : [ 'es2015', 'react', 'env' ]
}), {
poll : true
}); ...
In my package.json file, I have thos config for browserify:
"browserify": {
"transform": [
[
"babelify",
{
"presets": [
"es2015",
"env",
"react"
]
}
]
]
},
And I have the following dependencies:
"devDependencies": {
"babel-cli": "^6.24.1",
"babel-preset-env": "^1.5.2",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babelify": "^7.3.0",
"browserify": "^14.4.0",
"glob": "^7.1.2",
"gulp": "^3.9.1",
"gulp-cli": "^1.3.0",
"gulp-exit": "0.0.2",
"gulp-sourcemaps": "^2.6.0",
"gulp-uglify": "^3.0.0",
"vinyl-buffer": "^1.0.0",
"vinyl-source-stream": "^1.1.0",
"watchify": "^3.9.0"
}
As you can see, I may have added more presets that I need, I'm really new to this and I thought that maybe babel doesn't know that it's looking at a css file and treats it as jsx.