Skip to content

Commit

Permalink
feat(build): limit the size of UMD build fragment as much as possible
Browse files Browse the repository at this point in the history
Refs #2837
  • Loading branch information
char0n committed Feb 16, 2023
1 parent ae0e7e8 commit f8b9cf0
Show file tree
Hide file tree
Showing 3 changed files with 1,037 additions and 154 deletions.
19 changes: 6 additions & 13 deletions config/webpack/browser.config.babel.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import path from 'path';
import webpack from 'webpack';
import { StatsWriterPlugin } from 'webpack-stats-plugin';
import { DuplicatesPlugin } from 'inspectpack/plugin';
import { WebpackBundleSizeAnalyzerPlugin } from 'webpack-bundle-size-analyzer';
Expand Down Expand Up @@ -45,20 +44,12 @@ const browser = {
module,
plugins: [
new LodashModuleReplacementPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
}),
new DuplicatesPlugin({
// emit compilation warning or error? (Default: `false`)
emitErrors: false, // https://github.com/FormidableLabs/inspectpack/issues/181
// display full duplicates information? (Default: `false`)
verbose: true,
}),
new WebpackBundleSizeAnalyzerPlugin('swagger-client.browser-sizes.txt'),
new StatsWriterPlugin({
filename: path.join('swagger-client.browser-stats.json'),
fields: null,
}),
],
optimization: {
minimize: false,
Expand All @@ -74,8 +65,8 @@ const browserMin = {
devtool: 'source-map',
performance: {
hints: 'error',
maxEntrypointSize: 500000,
maxAssetSize: 1300000,
maxEntrypointSize: 350000,
maxAssetSize: 50000000,
},
output: {
path: path.resolve('./dist'),
Expand All @@ -95,8 +86,10 @@ const browserMin = {
module,
plugins: [
new LodashModuleReplacementPlugin(),
new webpack.LoaderOptionsPlugin({
minimize: true,
new WebpackBundleSizeAnalyzerPlugin('swagger-client.browser-sizes.txt'),
new StatsWriterPlugin({
filename: path.join('swagger-client.browser-stats.json'),
fields: null,
}),
],
optimization: {
Expand Down
Loading

0 comments on commit f8b9cf0

Please sign in to comment.