From c873cba3f38ea660cc74fb26b9338b876cb6453e Mon Sep 17 00:00:00 2001 From: Eric Amodio <eamodio@gmail.com> Date: Sat, 11 Feb 2023 13:09:35 -0500 Subject: [PATCH] Adds bundle analysis for webviews Removes JSON5 --- package.json | 1 - webpack.config.js | 9 ++++++--- yarn.lock | 10 +++++----- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index e067459..064d3f5 100644 --- a/package.json +++ b/package.json @@ -13094,7 +13094,6 @@ "html-loader": "4.2.0", "html-webpack-plugin": "5.5.0", "image-minimizer-webpack-plugin": "3.8.1", - "json5": "2.2.3", "license-checker-rseidelsohn": "4.1.1", "mini-css-extract-plugin": "2.7.2", "mocha": "10.2.0", diff --git a/webpack.config.js b/webpack.config.js index 30c7f2a..b5a57d7 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -2,6 +2,7 @@ /** @typedef {import('webpack').Configuration} WebpackConfig **/ const { spawnSync } = require('child_process'); +const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; const CircularDependencyPlugin = require('circular-dependency-plugin'); const { CleanWebpackPlugin: CleanPlugin } = require('clean-webpack-plugin'); const CopyPlugin = require('copy-webpack-plugin'); @@ -12,15 +13,13 @@ const ForkTsCheckerPlugin = require('fork-ts-checker-webpack-plugin'); const fs = require('fs'); const HtmlPlugin = require('html-webpack-plugin'); const ImageMinimizerPlugin = require('image-minimizer-webpack-plugin'); -const JSON5 = require('json5'); const MiniCssExtractPlugin = require('mini-css-extract-plugin'); const path = require('path'); const { validate } = require('schema-utils'); const TerserPlugin = require('terser-webpack-plugin'); -const { WebpackError, webpack, optimize } = require('webpack'); +const { WebpackError, optimize } = require('webpack'); const CssMinimizerPlugin = require('css-minimizer-webpack-plugin'); const { EsbuildPlugin } = require('esbuild-loader'); -const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; module.exports = /** @@ -341,6 +340,10 @@ function getWebviewsConfig(mode, env) { ); } + if (env.analyzeBundle) { + plugins.push(new BundleAnalyzerPlugin({ analyzerPort: 'auto' })); + } + return { name: 'webviews', context: basePath, diff --git a/yarn.lock b/yarn.lock index 4d1572a..ada204e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4276,11 +4276,6 @@ json-stable-stringify-without-jsonify@^1.0.1: resolved "https://registry.yarnpkg.com/json-stable-stringify-without-jsonify/-/json-stable-stringify-without-jsonify-1.0.1.tgz#9db7b59496ad3f3cfef30a75142d2d930ad72651" integrity sha512-Bdboy+l7tA3OGW6FjyFHWkP5LuByj1Tk33Ljyq0axyzdk9//JSi2u3fP1QSmd1KNwq6VOKYGlAu87CisVir6Pw== -json5@2.2.3, json5@^2.1.2: - version "2.2.3" - resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" - integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== - json5@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/json5/-/json5-1.0.2.tgz#63d98d60f21b313b77c4d6da18bfa69d80e1d593" @@ -4288,6 +4283,11 @@ json5@^1.0.1: dependencies: minimist "^1.2.0" +json5@^2.1.2: + version "2.2.3" + resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.3.tgz#78cd6f1a19bdc12b73db5ad0c61efd66c1e29283" + integrity sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg== + jsonfile@^6.0.1: version "6.1.0" resolved "https://registry.yarnpkg.com/jsonfile/-/jsonfile-6.1.0.tgz#bc55b2634793c679ec6403094eb13698a6ec0aae"