webpack.dev.conf.js 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. var config = require('../config')
  2. var webpack = require('webpack')
  3. var merge = require('webpack-merge')
  4. var utils = require('./utils')
  5. var baseWebpackConfig = require('./webpack.base.conf')
  6. var HtmlWebpackPlugin = require('html-webpack-plugin')
  7. var FriendlyErrors = require('friendly-errors-webpack-plugin')
  8. // add hot-reload related code to entry chunks
  9. Object.keys(baseWebpackConfig.entry).forEach(function(name) {
  10. baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
  11. })
  12. module.exports = merge(baseWebpackConfig, {
  13. module: {
  14. loaders: utils.styleLoaders({
  15. sourceMap: config.dev.cssSourceMap
  16. })
  17. },
  18. // eval-source-map is faster for development
  19. devtool: '#eval-source-map',
  20. plugins: [
  21. new webpack.DefinePlugin({
  22. 'process.env': config.dev.env
  23. }),
  24. // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
  25. new webpack.optimize.OccurrenceOrderPlugin(),
  26. new webpack.HotModuleReplacementPlugin(),
  27. new webpack.NoErrorsPlugin(),
  28. // https://github.com/ampedandwired/html-webpack-plugin
  29. new HtmlWebpackPlugin({
  30. filename: 'index.html',
  31. template: 'index.html',
  32. inject: true
  33. }),
  34. new FriendlyErrors()
  35. ]
  36. })