Timers and other features for Heroes of the Storm
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

webpack.dev.conf.js 1.4 KiB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. 'use strict'
  2. const fs = require('fs')
  3. const path = require('path')
  4. const utils = require('./utils')
  5. const webpack = require('webpack')
  6. const config = require('../config')
  7. const merge = require('webpack-merge')
  8. const baseWebpackConfig = require('./webpack.base.conf')
  9. const HtmlWebpackPlugin = require('html-webpack-plugin')
  10. const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
  11. // add hot-reload related code to entry chunks
  12. Object.keys(baseWebpackConfig.entry).forEach(function (name) {
  13. baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
  14. })
  15. module.exports = merge(baseWebpackConfig, {
  16. module: {
  17. rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
  18. },
  19. // cheap-module-eval-source-map is faster for development
  20. devtool: '#cheap-module-eval-source-map',
  21. plugins: [
  22. new webpack.DefinePlugin({
  23. 'process.env': config.dev.env
  24. }),
  25. // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
  26. new webpack.HotModuleReplacementPlugin(),
  27. new webpack.NoEmitOnErrorsPlugin(),
  28. // https://github.com/ampedandwired/html-webpack-plugin
  29. new HtmlWebpackPlugin({
  30. filename: 'index.html',
  31. template: 'index.html',
  32. inject: true,
  33. serviceWorkerLoader: `<script>${fs.readFileSync(path.join(__dirname,
  34. './service-worker-dev.js'), 'utf-8')}</script>`
  35. }),
  36. new FriendlyErrorsPlugin()
  37. ]
  38. })