Minify CSS with Lightning CSS (#25754)
Replace esbuild's rudimentary CSS minifier with [Lightning CSS](https://github.com/parcel-bundler/lightningcss), which results in around 4% smaller CSS bundle size, index.css goes from 608K to 584K. The module is quite new but has active use in the Parcel bundler, and as of yesterday is also under experimental support in Vite, so I trust it that bugs will be sorted out quickly. Before: `assets by path css/*.css 959 KiB` After: `assets by path css/*.css 933 KiB` I did give this a cursory test and everything seems to be in order.
This commit is contained in:
parent
3780795b93
commit
811fc9d49c
3 changed files with 214 additions and 1 deletions
|
@ -11,6 +11,7 @@ import webpack from 'webpack';
|
|||
import {fileURLToPath} from 'node:url';
|
||||
import {readFileSync} from 'node:fs';
|
||||
import {env} from 'node:process';
|
||||
import {LightningCssMinifyPlugin} from 'lightningcss-loader';
|
||||
|
||||
const {EsbuildPlugin} = EsBuildLoader;
|
||||
const {SourceMapDevToolPlugin, DefinePlugin} = webpack;
|
||||
|
@ -96,9 +97,10 @@ export default {
|
|||
new EsbuildPlugin({
|
||||
target: 'es2015',
|
||||
minify: true,
|
||||
css: true,
|
||||
css: false,
|
||||
legalComments: 'none',
|
||||
}),
|
||||
new LightningCssMinifyPlugin(),
|
||||
],
|
||||
splitChunks: {
|
||||
chunks: 'async',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue