Guest User

Untitled

a guest
Dec 8th, 2016
195
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. output: {
  10. path: path.join(__dirname, 'src', 'static', 'js'),
  11. publicPath: "/js/",
  12. filename: 'bundle.js'
  13. },
  14. module: {
  15. loaders: [{
  16. test: path.join(__dirname, 'src'),
  17. loader: ['babel-loader'],
  18. query: {
  19. cacheDirectory: 'babel_cache',
  20. presets: debug ? ['react', 'es2015', 'react-hmre'] : ['react', 'es2015']
  21. }
  22. }]
  23. },
  24. plugins: debug ? [] : [
  25. new webpack.DefinePlugin({
  26. 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
  27. }),
  28. new webpack.HotModuleReplacementPlugin(),
  29. new webpack.optimize.DedupePlugin(),
  30. new webpack.optimize.OccurenceOrderPlugin(),
  31. new webpack.NoErrorsPlugin(),
  32. new webpack.optimize.UglifyJsPlugin({
  33. compress: { warnings: false },
  34. mangle: true,
  35. sourcemap: false,
  36. beautify: false,
  37. dead_code: true
  38. }),
  39. ]
  40. };
Add Comment
Please, Sign In to add comment