Create-react-app: Production CSS is not minified/obfuscated

Created on 10 May 2020  路  9Comments  路  Source: facebook/create-react-app

While using global stylesheets with component classname props as usual, building for production leads to the same exact classnames still being used.

My best guess is that there would be significant css bundle size reduction if the
(_production only_) build process were to include any of the popular css minification tools.

https://github.com/css/csso
https://github.com/fmarcia/UglifyCSS
https://github.com/matthiasmullie/minify

Reproduction steps should be pretty straightforward, include a typical stylesheet into a component and use it, then build and inspect the result in devtools.

bug report needs triage stale

Most helpful comment

Gotta be honest, I'm not a fan of this bot. Just because people lose hope and stop showing up after months have gone by, doesn't mean the issue no longer exists or isn't important. If anything this bot should be aimed at the owners of the repo, it's been so long, surely, we at least deserve some response.

All 9 comments

Was just about to open an exactly similar issue. If CRA is using the 'css-loader' this would be as simple as configuring the loader in the following way:

{ 
  test: /\.css$/,
  use: [
    // ... other loaders ...
    {
      loader: 'css-loader',
      options: {
        modules: true, // minify CSS class names, set to false when in dev mode
        localIdentName: '[sha1:hash:hex:4]' // length of compressed identifiers
      }
    }
    // ... other loaders ...
  ]
}

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

Anyone looking into it?

I might look into it in a month or two, but not right now. Was hoping someone else would take care of this.

@gaearon @Timer @iansu Any thoughts?

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

Gotta be honest, I'm not a fan of this bot. Just because people lose hope and stop showing up after months have gone by, doesn't mean the issue no longer exists or isn't important. If anything this bot should be aimed at the owners of the repo, it's been so long, surely, we at least deserve some response.

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings