File tree Expand file tree Collapse file tree 7 files changed +41
-243
lines changed
Expand file tree Collapse file tree 7 files changed +41
-243
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " gdu " : minor
3+ ---
4+
5+ Add bundle analyser support for Vite builds via ` gdu build -a ` flag
Original file line number Diff line number Diff line change @@ -96,6 +96,31 @@ export const buildSPAVite = async (guruConfig: GuruConfig) => {
9696 } ) ,
9797 ) ;
9898
99+ if ( process . env . ANALYZE === 'true' ) {
100+ try {
101+ const { visualizer } = await dynamicImport (
102+ 'rollup-plugin-visualizer' ,
103+ ) ;
104+ runtimePlugins . push (
105+ visualizer ( {
106+ filename : join ( guruConfig . outputPath , 'bundle-report.html' ) ,
107+ open : false ,
108+ gzipSize : true ,
109+ brotliSize : true ,
110+ template : 'treemap' ,
111+ } ) ,
112+ ) ;
113+ } catch {
114+ console . warn (
115+ magenta (
116+ 'Warning: rollup-plugin-visualizer is not installed. ' +
117+ 'Install it to enable bundle analysis for Vite builds: ' +
118+ 'yarn add -D rollup-plugin-visualizer' ,
119+ ) ,
120+ ) ;
121+ }
122+ }
123+
99124 const { build } = ( await dynamicImport ( 'vite' ) ) as {
100125 build : ( config : InlineConfig ) => Promise < unknown > ;
101126 } ;
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import envCI from 'env-ci';
88import MiniCssExtractPlugin from 'mini-css-extract-plugin' ;
99import { MinifyOptions } from 'terser' ;
1010import TerserPlugin , { MinimizerOptions } from 'terser-webpack-plugin' ;
11- import { TreatPlugin } from 'treat/webpack-plugin' ;
1211import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin' ;
1312import {
1413 Configuration ,
@@ -23,7 +22,6 @@ import {
2322 getProjectFolderName ,
2423 getProjectName ,
2524} from '../../lib/config' ;
26- import { isProductionBuild } from '../../lib/misc' ;
2725import {
2826 CALLING_WORKSPACE_ROOT ,
2927 GDU_ROOT ,
@@ -388,17 +386,6 @@ export const baseOptions = ({
388386 branch,
389387 } ) ,
390388 } ) ,
391- new TreatPlugin ( {
392- outputLoaders : [
393- {
394- loader : isProductionBuild ( )
395- ? MiniCssExtractPlugin . loader
396- : require . resolve ( 'style-loader' ) ,
397- } ,
398- ] ,
399- minify : true ,
400- browsers,
401- } ) ,
402389 new VanillaExtractPlugin ( ) ,
403390 new MiniCssExtractPlugin ( {
404391 filename : `${ fileMask } .css` ,
Original file line number Diff line number Diff line change @@ -5,7 +5,6 @@ import browsers from 'browserslist-config-autoguru';
55import Dotenv from 'dotenv-webpack' ;
66import envCI from 'env-ci' ;
77import MiniCssExtractPlugin from 'mini-css-extract-plugin' ;
8- import { TreatPlugin } from 'treat/webpack-plugin' ;
98import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin' ;
109import {
1110 Configuration ,
@@ -354,15 +353,6 @@ export const baseDevelopmentOptions = ({
354353 branch,
355354 } ) ,
356355 } ) ,
357- new TreatPlugin ( {
358- outputLoaders : [
359- {
360- loader : require . resolve ( 'style-loader' ) ,
361- } ,
362- ] ,
363- minify : false ,
364- browsers,
365- } ) ,
366356 new VanillaExtractPlugin ( ) ,
367357 new MiniCssExtractPlugin ( {
368358 filename : `${ fileMask } .css` ,
Original file line number Diff line number Diff line change @@ -8,7 +8,6 @@ import envCI from 'env-ci';
88import MiniCssExtractPlugin from 'mini-css-extract-plugin' ;
99import { MinifyOptions } from 'terser' ;
1010import TerserPlugin , { MinimizerOptions } from 'terser-webpack-plugin' ;
11- import { TreatPlugin } from 'treat/webpack-plugin' ;
1211import { TsconfigPathsPlugin } from 'tsconfig-paths-webpack-plugin' ;
1312import {
1413 Configuration ,
@@ -18,7 +17,6 @@ import {
1817} from 'webpack' ;
1918
2019import { getGuruConfig , getProjectName } from '../../lib/config' ;
21- import { isProductionBuild } from '../../lib/misc' ;
2220import { CALLING_WORKSPACE_ROOT , PROJECT_ROOT } from '../../lib/roots' ;
2321import { getHooks } from '../../utils/hooks' ;
2422
@@ -305,17 +303,6 @@ export const makeWebComponentsWebpackConfig = (
305303 branch,
306304 } ) ,
307305 } ) ,
308- new TreatPlugin ( {
309- outputLoaders : [
310- {
311- loader : isProductionBuild ( )
312- ? MiniCssExtractPlugin . loader
313- : require . resolve ( 'style-loader' ) ,
314- } ,
315- ] ,
316- minify : ! isDev ,
317- browsers,
318- } ) ,
319306 new VanillaExtractPlugin ( ) ,
320307 new MiniCssExtractPlugin ( {
321308 filename : `${ fileMask } .css` ,
Original file line number Diff line number Diff line change 8383 "sade" : " ^1.7.4" ,
8484 "tapable" : " ^2.2.0" ,
8585 "terser-webpack-plugin" : " ^5.3.11" ,
86- "treat" : " 2.0.4" ,
8786 "ts-dedent" : " ^2.2.0" ,
8887 "tsconfig-paths-webpack-plugin" : " ^3.5.2" ,
8988 "url-loader" : " ^4.1.1" ,
You can’t perform that action at this time.
0 commit comments