Timers and other features for Heroes of the Storm
Não pode escolher mais do que 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.
 
 
 
 
 

61 linhas
2.2 KiB

  1. /*
  2. * Copyright © 2021 Adrien Agez <adrien.agez@pm.me>
  3. *
  4. * This file is part of Nexus Timers.
  5. *
  6. * Nexus Timers is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU Affero General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * Nexus Timers is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU Affero General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Affero General Public License
  17. * along with Nexus Timers. If not, see <https://www.gnu.org/licenses/>.
  18. */
  19. 'use strict'
  20. const fs = require('fs')
  21. const path = require('path')
  22. const utils = require('./utils')
  23. const webpack = require('webpack')
  24. const config = require('../config')
  25. const merge = require('webpack-merge')
  26. const baseWebpackConfig = require('./webpack.base.conf')
  27. const HtmlWebpackPlugin = require('html-webpack-plugin')
  28. const FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin')
  29. // add hot-reload related code to entry chunks
  30. Object.keys(baseWebpackConfig.entry).forEach(function (name) {
  31. baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name])
  32. })
  33. module.exports = merge(baseWebpackConfig, {
  34. module: {
  35. rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap })
  36. },
  37. // cheap-module-eval-source-map is faster for development
  38. devtool: '#cheap-module-eval-source-map',
  39. plugins: [
  40. new webpack.DefinePlugin({
  41. 'process.env': config.dev.env
  42. }),
  43. // https://github.com/glenjamin/webpack-hot-middleware#installation--usage
  44. new webpack.HotModuleReplacementPlugin(),
  45. new webpack.NoEmitOnErrorsPlugin(),
  46. // https://github.com/ampedandwired/html-webpack-plugin
  47. new HtmlWebpackPlugin({
  48. filename: 'index.html',
  49. template: 'index.html',
  50. inject: true,
  51. serviceWorkerLoader: `<script>${fs.readFileSync(path.join(__dirname,
  52. './service-worker-dev.js'), 'utf-8')}</script>`
  53. }),
  54. new FriendlyErrorsPlugin()
  55. ]
  56. })