Advertisement
Guest User

Untitled

a guest
Dec 16th, 2015
490
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 KB | None | 0 0
  1. import path from 'path';
  2. import webpack, { DefinePlugin, BannerPlugin, HotModuleReplacementPlugin, NoErrorsPlugin } from 'webpack';
  3. import merge from 'lodash/object/merge';
  4.  
  5. const DEBUG = !process.argv.includes('--release');
  6.  
  7. const GLOBALS = {
  8. 'process.env.NODE_ENV': DEBUG ? '"development"' : '"production"',
  9. __DEV__: DEBUG
  10. };
  11.  
  12. const config = {
  13. output: {
  14. publicPath: '/',
  15. sourcePrefix: ' '
  16. },
  17. cache: true,
  18. debug: true,
  19. plugins: [
  20. new webpack.optimize.OccurenceOrderPlugin()
  21. ]
  22. };
  23.  
  24. const appConfig = merge({}, config, {
  25. entry: [
  26. 'webpack-hot-middleware/client',
  27. './src/client/app.js'
  28. ],
  29. output: {
  30. path: path.join(__dirname, '../build/public'),
  31. filename: 'app.js'
  32. },
  33. devtool: 'cheap-module-eval-source-map',
  34. plugins: [
  35. ...config.plugins,
  36. new webpack.DefinePlugin(GLOBALS),
  37. new HotModuleReplacementPlugin(),
  38. new NoErrorsPlugin()
  39. ],
  40. module: {
  41. loaders: [{
  42. test: /\.js?$/,
  43. include: [
  44. path.resolve(__dirname, '../src')
  45. ],
  46. loaders: ['react-hot', 'babel-loader']
  47. }]
  48. }
  49. });
  50.  
  51. export default appConfig;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement