webpack+react搭建

https://my.oschina.net/u/1403181/blog/672501

webpack.config.js配置支持jsx

var path = require('path');
var webpack = require('webpack');
module.exports = {
entry: {
'bundle':'./app/main.js',
'test':'./app/test.jsx'
},

output: {
path: path.resolve(__dirname, './build'),
filename: '[name].js'
},

resolve: {
extensions: ['', '.js', '.jsx']
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}

}
]
},
plugins: [
new webpack.HotModuleReplacementPlugin()
]
};

你可能感兴趣的:(Web前端)