ant-design按需引入,缩小包体积

This commit is contained in:
albert
2023-04-26 21:31:33 +08:00
parent c7fbd12336
commit e173a0c27e
10 changed files with 476 additions and 41056 deletions

View File

@@ -1,25 +1,28 @@
const LodashModuleReplacementPlugin = require("lodash-webpack-plugin")
const webpack = require('webpack')
const path = require('path')
module.exports = {
publicPath: './',
productionSourceMap: false,
pages: {
index: {
entry: 'examples/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
devServer: {
// development server port 8000
port: 8080
}
// css: {
// loaderOptions: {
// less: {
// lessOptions: {
// // important extra layer for less-loader^6.0.0
// javascriptEnabled: true
// }
// }
// }
// }
publicPath: './',
productionSourceMap: false,
pages: {
index: {
entry: 'examples/main.js',
template: 'public/index.html',
filename: 'index.html'
}
},
configureWebpack:{
plugins: [
new webpack.IgnorePlugin({
resourceRegExp: /^\.\/locale$/,
contextRegExp: /moment$/,
}),
]
},
chainWebpack(config) {
if(process.env.analyzer) config.plugin('webpack-report').use(require('webpack-bundle-analyzer').BundleAnalyzerPlugin)
config.plugin("loadshReplace").use(new LodashModuleReplacementPlugin())
}
}