build(webpack): bundle size optimization for lodash (#6244)

* add duplicate code detection check for general purpose use
* webpack alias for lodash
* redux and react-redux dependency bump that removes lodash dependencies
* lodash version match with swagger-client and recent security update
* additional webpack config to help reduce build sizes
* restore max bundle size back to 1024000
This commit is contained in:
Tim Lai
2020-07-20 20:26:56 -07:00
committed by GitHub
parent cb16ba4e6a
commit d12662e354
6 changed files with 382 additions and 36 deletions

View File

@@ -2,9 +2,10 @@
* @prettier
*/
import path from "path"
import configBuilder from "./_config-builder"
import { DuplicatesPlugin } from "inspectpack/plugin"
import LodashModuleReplacementPlugin from "lodash-webpack-plugin"
import { WebpackBundleSizeAnalyzerPlugin } from "webpack-bundle-size-analyzer"
const result = configBuilder(
{
@@ -20,10 +21,19 @@ const result = configBuilder(
"./src/core/index.js",
],
},
output: {
library: "SwaggerUIBundle",
},
plugins: [
new DuplicatesPlugin({
// emit compilation warning or error? (Default: `false`)
emitErrors: false,
// display full duplicates information? (Default: `false`)
verbose: false,
}),
new LodashModuleReplacementPlugin(),
new WebpackBundleSizeAnalyzerPlugin("log.bundle-sizes.swagger-ui.txt"),
]
}
)