Skip to content
This repository has been archived by the owner on Jun 5, 2021. It is now read-only.

Use the MiniCssExtractPlugin loader in prod mode #42

Merged
merged 1 commit into from
Jan 10, 2019

Conversation

borgstrom
Copy link
Contributor

Hi again, @fwouts 👋

I noticed that the MinCssExtractPlugin was being wired up in the plugins, but that my bundles didn't contain .css files.

https://github.com/zenclabs/bazel-javascript/blob/68f8fbb/internal/web_bundle/create_webpack_config.js#L206-L213

Assets: 
  vendors.6da814537306d64a3dfd.js (1.12 MiB)
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (1.13 MiB)
      runtime~main.6b090734559577c38d3f.js
      vendors.6da814537306d64a3dfd.js
      main.08d5e5a6765d3f845f23.js

webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Target //web/apps/admin:prod up-to-date:
  bazel-bin/web/apps/admin/prod_bundle

This PR uses the MiniCssExtractPlugin.loader in production mode and style-loader otherwise, per https://github.com/webpack-contrib/mini-css-extract-plugin#advanced-configuration-example

My bundle now looks like:

Assets: 
  vendors.c8cd3ea9c2a4ad36dbb8.js (1.1 MiB)
entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  main (1.12 MiB)
      runtime~main.6b090734559577c38d3f.js
      vendors.c8cd3ea9c2a4ad36dbb8.chunk.css
      vendors.c8cd3ea9c2a4ad36dbb8.js
      main.e6e96dba7f6f5e6ee764.chunk.css
      main.e6e96dba7f6f5e6ee764.js

webpack performance recommendations: 
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
Target //web/apps/admin:prod up-to-date:
  bazel-bin/web/apps/admin/prod_bundle

Thanks again for these rules!

@CLAassistant
Copy link

CLAassistant commented Jan 10, 2019

CLA assistant check
All committers have signed the CLA.

@borgstrom borgstrom force-pushed the use-min-css-extract branch from ac9cdaa to bb87ee4 Compare January 10, 2019 04:53
@borgstrom borgstrom force-pushed the use-min-css-extract branch from bb87ee4 to aeb75db Compare January 10, 2019 04:56
Copy link
Owner

@fwouts fwouts left a comment

Choose a reason for hiding this comment

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

Awesome, thanks for fixing!

@fwouts fwouts merged commit e1c5505 into fwouts:master Jan 10, 2019
@borgstrom borgstrom deleted the use-min-css-extract branch January 10, 2019 04:58
@fwouts
Copy link
Owner

fwouts commented Jan 10, 2019

@borgstrom This is now included in 0.0.27.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants