webpack.config.js 813 B

12345678910111213141516171819202122232425262728293031323334353637383940
  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. 'babel-polyfill',
  8. './src/index.js'
  9. ],
  10. module: {
  11. loaders: [
  12. {
  13. test: /\.jsx?$/,
  14. exclude: /node_modules/,
  15. loaders: ['react-hot-loader/webpack', 'babel-loader']
  16. }
  17. ]
  18. },
  19. resolve: {
  20. extensions: ['*', '.js', '.jsx']
  21. },
  22. output: {
  23. path: __dirname + '/build',
  24. publicPath: '/',
  25. filename: 'bundle.js'
  26. },
  27. devServer: {
  28. contentBase: './public',
  29. hot: true
  30. },
  31. plugins: [
  32. new webpack.optimize.ModuleConcatenationPlugin(),
  33. new webpack.DefinePlugin({
  34. 'process.env': {
  35. NODE_ENV: JSON.stringify('production')
  36. }
  37. })
  38. ]
  39. };