webpack.dll.config.js 842 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. const path = require('path');
  2. const merge = require('deepmerge');
  3. const webpack = require('webpack');
  4. const baseConfig = require('../base-webpack.config');
  5. const SpritePlugin = require('../../plugin');
  6. module.exports = merge(baseConfig, {
  7. context: __dirname,
  8. entry: {
  9. dll: ['./dll']
  10. },
  11. output: {
  12. path: path.resolve(__dirname, 'build'),
  13. library: 'dll'
  14. },
  15. module: {
  16. rules: [
  17. {
  18. test: /\.svg$/,
  19. use: [
  20. // 'svg-sprite-loader',
  21. {
  22. loader: 'svg-sprite-loader',
  23. options: { extract: true, spriteFilename: 'dll.svg' }
  24. },
  25. 'svgo-loader'
  26. ]
  27. }
  28. ]
  29. },
  30. plugins: [
  31. new webpack.DllPlugin({
  32. path: path.join(__dirname, 'build', '[name]-manifest.json'),
  33. name: 'dll'
  34. }),
  35. new SpritePlugin()
  36. ]
  37. });