webpack配置react环境
- webpack插件:
npm install babel-core babel-loader babel-preset-react babel-preset-es2015 create-react-class prop-types
- sublime插件:
jsx // 高亮jsx语法
- 修改webpack配置文件:
const path = require('path'); module.exports = { entry: './src/index.js', devtool: 'inline-source-map', devServer: { contentBase: './dist' }, output: { filename: 'bundle.js', path: path.resolve(__dirname, 'dist') }, module: { rules: [ { test: /\.jsx?$/, exclude: /node_modules/, loader: 'babel-loader', query: { presets: ['es2015', 'react'] } } ] } };
- 测试:
当前题目:webpack配置react环境
分享网址:http://hbruida.cn/article/ppoche.html