GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat: minimize css when css experiment is enabled by burhanuday · Pull Request #17309 · webpack/webpack

Conversation

@burhanuday

@burhanuday burhanuday commented Jun 3, 2023 •
edited by ghost
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Part of #14893

css minimizer

Maybe we could start with using the existing webpack plugin rather than building another one from scratch?

Summary

🤖 Generated by Copilot at d3ad1ac

This pull request adds support for CSS minification as an experimental feature in webpack 5. It introduces a new dev dependency, css-minimizer-webpack-plugin, and modifies the default configuration, the test framework, and the test cases to enable and verify the feature.

Details

🤖 Generated by Copilot at d3ad1ac

  • Add CSS minification as an experimental feature in webpack 5 (link, link)
  • Modify describeCases function in test/ConfigTestCases.template.js to append css-minimizer-webpack-plugin to the minimizer array if css experiment is enabled (link)
  • Add a new test case for CSS minification in test/configCases/optimization/css-minimize (link, link, link, link)

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Burhanuddin Udaipurwala added 4 commits June 1, 2023 21:05
Burhanuddin Udaipurwala
feat: add css minimizer webpack plugin to dependencies
ddaa978
Burhanuddin Udaipurwala
test: add test for minimizer
9865a51
Burhanuddin Udaipurwala
test: add minimizer for css when experiment enabled
550df9d
Burhanuddin Udaipurwala
test: add test for css minimization
d3ad1ac
@webpack-bot webpack-bot added the PR: unreviewed label Jun 3, 2023
@webpack-bot

webpack-bot commented Jun 3, 2023

Copy link
Copy Markdown
Contributor

For maintainers only:

  • This needs to be documented (issue in webpack/webpack.js.org will be filed when merged)
  • This needs to be backported to webpack 4 (issue will be created when merged)
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Burhanuddin Udaipurwala
chore: yarn de duplicate
84153ad
alexander-akait
alexander-akait requested changes Jun 3, 2023
View reviewed changes

@alexander-akait alexander-akait left a comment

Copy link
Copy Markdown
Member

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should postpone it for webpack v6, cssnano is big and slow and we need to think about it deeply, perhaps we can collaborate with the rspack team

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@webpack-bot webpack-bot added PR: reviewed-changes-requested and removed PR: unreviewed labels Jun 3, 2023
@burhanuday

burhanuday commented Jun 4, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

I think we should postpone it for webpack v6, cssnano is big and slow and we need to think about it deeply, perhaps we can collaborate with the rspack team

If speed is the concern then we could try out LightningCSS. css-minimizer-webpack-plugin has support for LightningCSS - https://lightningcss.dev/docs.html#with-webpack

Though a different problem with css-minimizer-webpack-plugin is Node v10 support.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@TheLarkInn

TheLarkInn commented Jun 5, 2023

Copy link
Copy Markdown
Member

@hardfist We should collaborate here, maybe not this exact implementation but have a common goal for CSS minification for native CSS support?

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hardfist

hardfist commented Jun 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@hardfist We should collaborate here, maybe not this exact implementation but have a common goal for CSS minification for native CSS support?

we are using swc-css to minify css because we are also using swc-css to support native css,but swc-css might have bigger size than lightning css,which may be a concern for webpack
if we use lightning-css or swc-css in webpack,should we use the wasm version or napi version?since webpack 5 still sipports node10 then it may have some compatible in old node version

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Jun 5, 2023

Copy link
Copy Markdown
Member

@hardfist Node.js 10 is not our radar, so we can say - if you want the latest feature - do not use node.js 10, you the latest LTS, but yeah wasm solution will be fine (still need check perf)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hardfist

hardfist commented Jun 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

since webpack already implemented a css parser for native css support, it seems webpack could reimplement the css minification using the same parser(same parser for parse & minification seems ideal, but it maybe out of scope)

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hardfist

hardfist commented Jun 5, 2023

Copy link
Copy Markdown
Contributor

I think we should postpone it for webpack v6, cssnano is big and slow and we need to think about it deeply, perhaps we can collaborate with the rspack team

I agree with that, webpack's default css minifier should be small & fast otherwise people may blame webpack for speed, and it seems vite5 may plan to choose lightning css as css minifier vitejs/vite#12466.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Jun 5, 2023

Copy link
Copy Markdown
Member

@hardfist yeah, but there is a performance bottleneck between js and rust - serialization (you know 😄 ), I honestly don't know what would be better for us:

  • on the one hand, implement another minifier is a bad idea, I already implemened swc css minification (there are still a lot of improvement, but it is out of this dicussion) and there is a cssnano, which is also under my responsibility
  • on the other side - cssnano built on PostCSS, it is slow and have a big size, using swc minificator will cost perfomance for us due serialization
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Jun 5, 2023

Copy link
Copy Markdown
Member

Perhaps we should really look at wasm and focus our efforts on swc minificator

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@hardfist

hardfist commented Jun 5, 2023 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

serialization maybe not a problem for minify but a problem for parse,if size is not a concern for webpack i think swc minification or lightingcss is a better option for css minify

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Jun 6, 2023

Copy link
Copy Markdown
Member

Yeah, I will think about it more

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@webpack-bot webpack-bot added the PR: conflict label Jun 14, 2023
@burhanuday burhanuday mentioned this pull request Jun 18, 2023
Inbuilt support for alternate minifiers #17398
Closed
@burhanuday

burhanuday commented Jun 20, 2023

Copy link
Copy Markdown
Author

vite has added support for lightningcss vitejs/vite#12807

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Jun 20, 2023

Copy link
Copy Markdown
Member

@burhanuday We've been supporting this for a long time (minimizers), even more - we support all known CSS minimizer

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@9aoy 9aoy mentioned this pull request Aug 14, 2023
Webpack compatible builtins should also be available via new rspack.XXXPlugin() web-infra-dev/rspack#3740
Closed
@hardfist

hardfist commented Jun 19, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Contributor

@alexander-akait rspack supports minimize css out of box now, but one thing comes out if rspack | webpack supports css minimizer out of box
because css and js may share the same optimization.minizer configuration, if user only want to override css or js minimizer they need to explicitly configure other default minimizer

// override 
module.exports = {
  // ...
  optimization: {
    minimizer: [new rspack.LightningCssMinimizerRspackPlugin()], // this will cause js minizer is overwritten
  },
};
// explicitly override
module.exports = {
  // ...
  optimization: {
    minimizer: [new rspack.LightningCssMinimizerRspackPlugin(), rspack.SwcJsMinimizerRspackPlugin()], // this will cause '...' less useful and user need to custom the default js mimizer
  },
};

it can be solved if we can split minimizer option for js and css

module.exports = {
  // ...
  optimization: {
    minimizer: 
     {
      css:  [new rspack.LightningCssMinimizerRspackPlugin() ] // this will only override css minimizer but js minimizer still use the default
     } 
  },
};
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Jun 19, 2024

Copy link
Copy Markdown
Member

@hardfist I am fine with CSS minimizer out of box, the main problem - I want to finish all CSS roadmap and then merge it to avoid extra deps when developers still on css-loader/style-loader/mini-css-extract-plugin, briefly - it should be the last PR 😄

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait

alexander-akait commented Jul 24, 2026

Copy link
Copy Markdown
Member

Close in favor of #21491

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@alexander-akait alexander-akait closed this Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@alexander-akait alexander-akait alexander-akait requested changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@burhanuday @webpack-bot @TheLarkInn @hardfist @alexander-akait
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.