Guest User

Untitled

a guest
Dec 8th, 2016
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 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. port: 3333,
  11. contentBase: "src/static/",
  12. historyApiFallback: {
  13. index: '/index-static.html'
  14. }
  15. },
  16. output: {
  17. path: path.join(__dirname, 'src', 'static', 'js'),
  18. publicPath: "/js/",
  19. filename: 'bundle.js'
  20. },
  21. module: {
  22. loaders: [{
  23. test: path.join(__dirname, 'src'),
  24. loader: ['babel-loader'],
  25. query: {
  26. cacheDirectory: 'babel_cache',
  27. presets: debug ? ['react', 'es2015', 'react-hmre'] : ['react', 'es2015']
  28. }
  29. }]
  30. },
  31. plugins: debug ? [] : [
  32. new webpack.DefinePlugin({
  33. 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
  34. }),
  35. new webpack.HotModuleReplacementPlugin(),
  36. new webpack.optimize.DedupePlugin(),
  37. new webpack.optimize.OccurenceOrderPlugin(),
  38. new webpack.NoErrorsPlugin(),
  39. new webpack.optimize.UglifyJsPlugin({
  40. compress: { warnings: false },
  41. mangle: true,
  42. sourcemap: false,
  43. beautify: false,
  44. dead_code: true
  45. }),
  46. ]
  47. };
Add Comment
Please, Sign In to add comment