I'm starting to learn ReactJs
, and I was trying to build an environment from scratch using this "builder".
Everything works pretty well, but I'd like to work with .jsx
files instead of .js
(the text editor screws up otherwise, and ir feels better using a different extension for not-compiled scripts)
However, I didn't manage to compile such .jsx
files, it only works with .js
files.
This is the configuration files for .babelrc
:
{
"presets":["es2015","react"]
}
And my webpack.config.js
:
var path = require('path');
var config = {
context: path.join(__dirname,'src'),
entry:[
'./main.js'
],
output:{
path :path.join(__dirname,'www'),
filename:'bundle.js'
},
module:{
loaders:[
{
test: /\.js$/,
exclude:/node_modules/,
loaders:['babel']
}
],
},
resolveLoader:{
root: [
path.join(__dirname,'node_modules')
]
},
resolve:{
root:[
path.join(__dirname,'node_modules')
]
}
};
module.exports = config;
I tried simply changing the extensions in the webpack config file from js
to jsx
, but to no avail.
Any ideas?