webpack.config.js 791 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. const webpack = require('webpack');
  2. module.exports = {
  3. entry: [
  4. 'webpack-dev-server/client?http://localhost:8080',
  5. 'webpack/hot/only-dev-server',
  6. 'react-hot-loader/patch',
  7. './src/index.js'
  8. ],
  9. module: {
  10. loaders: [
  11. {
  12. test: /\.jsx?$/,
  13. exclude: /node_modules/,
  14. loaders: ['react-hot-loader/webpack', 'babel-loader']
  15. }
  16. ]
  17. },
  18. resolve: {
  19. extensions: ['*', '.js', '.jsx']
  20. },
  21. output: {
  22. path: __dirname + '/build',
  23. publicPath: '/',
  24. filename: 'bundle.js'
  25. },
  26. devServer: {
  27. contentBase: './public',
  28. hot: true
  29. },
  30. plugins: [
  31. new webpack.optimize.ModuleConcatenationPlugin(),
  32. new webpack.DefinePlugin({
  33. 'process.env': {
  34. NODE_ENV: JSON.stringify('production')
  35. }
  36. })
  37. ]
  38. };