webpack.config.js 778 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /* eslint-disable import/no-extraneous-dependencies */
  2. const path = require('path');
  3. const merge = require('deepmerge');
  4. const baseConfig = require('../base-webpack.config');
  5. const SpritePlugin = require('../../plugin');
  6. const HtmlPlugin = require('html-webpack-plugin');
  7. const config = merge(baseConfig, {
  8. context: __dirname,
  9. entry: './main',
  10. output: {
  11. path: path.resolve(__dirname, 'build')
  12. },
  13. module: {
  14. rules: [
  15. {
  16. test: /\.svg$/,
  17. loader: 'svg-sprite-loader',
  18. options: { extract: true }
  19. }
  20. ]
  21. },
  22. plugins: [
  23. new HtmlPlugin({
  24. filename: 'index.html',
  25. template: path.resolve(__dirname, 'template.ejs')
  26. }),
  27. new SpritePlugin({
  28. plainSprite: true
  29. })
  30. ]
  31. });
  32. module.exports = config;