Timers and other features for Heroes of the Storm
Você não pode selecionar mais de 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 
 
 

42 linhas
1.4 KiB

  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. })