const path = require('path'); const paths = require('./paths'); const webpack = require('webpack'); const ProgressBarPlugin = require('progress-bar-webpack-plugin'); const { CleanWebpackPlugin } = require('clean-webpack-plugin'); module.exports = { // devtool: 'cheap-eval-source-map', devtool: 'cheap-source-map', entry: { vendor: [ '@ant-design/compatible', '@ant-design/icons', 'form-render', 'antd', 'dayjs', 'mockjs', 'lodash', 'axios', 'immutable', 'styled-components', 'react', 'prop-types', 'react-dom', 'redux', 'react-redux', 'redux-actions', 'redux-saga', 'reselect', 'react-loadable', 'react-intl', 'react-helmet', 'react-onclickoutside', 'redux-logger', 'redux-immutable', 'react-motion', 'react-virtualized', 'recharts', 'iframe-resizer', 'nprogress', 'codemirror', 'react-dnd', 'react-dnd-html5-backend', 'react-draggable', 'react-image', 'react-json-view', 'react-quill', 'react-split-pane', 'react-virtualized-select', 'swagger-ui', 'swagger-ui-react', ], }, output: { path: paths.appDist, filename: '[name].dll.js', pathinfo: true, library: '_[name]_dll', }, plugins: [ new ProgressBarPlugin({ format: 'Build [:bar] :percent (:elapsed seconds)', clear: false, }), new CleanWebpackPlugin(), new webpack.ContextReplacementPlugin(/moment[\/\\]locale$/, /en-gb|zh-cn/), new webpack.DllPlugin({ name: '_[name]_dll', //和output.library中一致,也就是输出的manifest.json中的 name值 path: path.join(paths.appDist, '[name].manifest.json'), context: paths.appSrc, }), ], };