Guest User

Untitled

a guest
Dec 8th, 2016
1,053
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. const debug = process.env.NODE_ENV !== "production";
  2.  
  3. const webpack = require('webpack');
  4. const path = require('path');
  5.  
  6. module.exports = {
  7. devtool: debug ? 'inline-sourcemap' : null,
  8. entry: 'webpack-hot-middleware/client',
  9. devServer: {
  10. inline: true,
  11. port: 3333,
  12. hot: true,
  13. contentBase: "src/static/",
  14. historyApiFallback: {
  15. index: '/index-static.html'
  16. }
  17. },
  18. output: {
  19. path: path.join(__dirname, 'src', 'static', 'js'),
  20. publicPath: "/js/",
  21. filename: 'bundle.js'
  22. },
  23. module: {
  24. loaders: [{
  25. test: path.join(__dirname, 'src'),
  26. loader: ['babel-loader'],
  27. query: {
  28. cacheDirectory: 'babel_cache',
  29. presets: debug ? ['react', 'es2015', 'react-hmre'] : ['react', 'es2015']
  30. }
  31. }]
  32. },
  33. plugins: debug ? [] : [
  34. new webpack.DefinePlugin({
  35. 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
  36. }),
  37. new webpack.HotModuleReplacementPlugin(),
  38. new webpack.optimize.DedupePlugin(),
  39. new webpack.optimize.OccurenceOrderPlugin(),
  40. new webpack.NoErrorsPlugin(),
  41. new webpack.optimize.UglifyJsPlugin({
  42. compress: { warnings: false },
  43. mangle: true,
  44. sourcemap: false,
  45. beautify: false,
  46. dead_code: true
  47. }),
  48. ]
  49. };
Add Comment
Please, Sign In to add comment