webpack配置react环境

  1. webpack插件:
    npm  install  babel-core  babel-loader  babel-preset-react  babel-preset-es2015  create-react-class  prop-types
  2. sublime插件:
    jsx  // 高亮jsx语法
  3. 修改webpack配置文件:
    webpack配置react环境
    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']
          }
        }
      ]
    }
    };
  4. 测试:
    webpack配置react环境
    webpack配置react环境
    webpack配置react环境

新闻名称:webpack配置react环境
链接分享:http://lszwz.com/article/ppoche.html

其他资讯

售后响应及时

7×24小时客服热线

数据备份

更安全、更高效、更稳定

价格公道精准

项目经理精准报价不弄虚作假

合作无风险

重合同讲信誉,无效全额退款