webpack.dev.conf.js 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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. // add hot-reload related code to entry chunks
  8. Object.keys(baseWebpackConfig.entry).forEach(function (name) {
  9. baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
  10. })
  11. module.exports = merge(baseWebpackConfig, {
  12. module: {
  13. rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
  14. },
  15. mode: 'development',
  16. // eval-source-map is faster for development
  17. devtool: 'eval-source-map',
  18. plugins: [
  19. new webpack.DefinePlugin({
  20. 'process.env': config.dev.env,
  21. 'COMMIT_HASH': JSON.stringify('DEV'),
  22. 'DEV_OVERRIDES': JSON.stringify(config.dev.settings),
  23. '__VUE_OPTIONS_API__': true,
  24. '__VUE_PROD_DEVTOOLS__': false
  25. }),
  26. // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
  27. new webpack.HotModuleReplacementPlugin(),
  28. // https://github.com/ampedandwired/html-webpack-plugin
  29. new HtmlWebpackPlugin({
  30. filename: 'index.html',
  31. template: 'index.html',
  32. inject: true
  33. })
  34. ]
  35. })