webpack.config.dll.js 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. const path = require('path');
  2. const paths = require('./paths');
  3. const webpack = require('webpack');
  4. const ProgressBarPlugin = require('progress-bar-webpack-plugin');
  5. const { CleanWebpackPlugin } = require('clean-webpack-plugin');
  6. module.exports = {
  7. // devtool: 'cheap-eval-source-map',
  8. devtool: 'cheap-source-map',
  9. entry: {
  10. vendor: [
  11. '@ant-design/compatible',
  12. '@ant-design/icons',
  13. 'form-render',
  14. 'antd',
  15. 'dayjs',
  16. 'mockjs',
  17. 'lodash',
  18. 'axios',
  19. 'immutable',
  20. 'styled-components',
  21. 'react',
  22. 'prop-types',
  23. 'react-dom',
  24. 'redux',
  25. 'react-redux',
  26. 'redux-actions',
  27. 'redux-saga',
  28. 'reselect',
  29. 'react-loadable',
  30. 'react-intl',
  31. 'react-helmet',
  32. 'react-onclickoutside',
  33. 'redux-logger',
  34. 'redux-immutable',
  35. 'react-motion',
  36. 'react-virtualized',
  37. 'recharts',
  38. 'iframe-resizer',
  39. 'nprogress',
  40. 'codemirror',
  41. 'react-dnd',
  42. 'react-dnd-html5-backend',
  43. 'react-draggable',
  44. 'react-image',
  45. 'react-json-view',
  46. 'react-quill',
  47. 'react-split-pane',
  48. 'react-virtualized-select',
  49. 'swagger-ui',
  50. 'swagger-ui-react',
  51. ],
  52. },
  53. output: {
  54. path: paths.appDist,
  55. filename: '[name].dll.js',
  56. pathinfo: true,
  57. library: '_[name]_dll',
  58. },
  59. plugins: [
  60. new ProgressBarPlugin({
  61. format: 'Build [:bar] :percent (:elapsed seconds)',
  62. clear: false,
  63. }),
  64. new CleanWebpackPlugin(),
  65. new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb|zh-cn/),
  66. new webpack.DllPlugin({
  67. name: '_[name]_dll', //和output.library中一致,也就是输出的manifest.json中的 name值
  68. path: path.join(paths.appDist, '[name].manifest.json'),
  69. context: paths.appSrc,
  70. }),
  71. ],
  72. };