Skip to content

feat(*): Webpack 4 Support for Universal CSS Chunks #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Jun 4, 2018

Conversation

ScriptedAlchemy
Copy link
Collaborator

@ScriptedAlchemy ScriptedAlchemy commented Jun 2, 2018

Webpack 4 support for extract-css-chunks universal-component react-universal. Complete with full
chunking, code splitting, real and true hot module reloading. Compatible with faceyspacey universal
code splitting and server-side rendering.

Pretty much its great chunking like before, with really slick HMR. Putting it all together. The only plugin that does both css code splitting and HMR 👍
From Readme:

Perks

  • HMR: It also has first-class support for Hot Module Replacement across ALL those css files/chunks!!!
  • cacheable stylesheets
  • smallest total bytes sent compared to "render-path" css-in-js solutions that include your CSS definitions in JS
  • Faster than the V2!
  • Async loading
  • No duplicate compilation (performance)
  • Easier to use
  • Specific to CSS
  • SSR Friendly development build, focused on frontend DX
  • Works seamlessly with the Universal family
  • Works fantastically as a standalone style loader (You can use it for any webpack project! with no extra dependencies!)

BREAKING CHANGE: EVERYTHING! This its a complete rewrite. Top to bottom!! This is a major change to the API and Loader. It will intergrate with universal without a issue and IT DOES NOT RELY ON
UNIVERSAL COMPONENTS.

fix #60, re #36 #47 #51

Webpack 4 support for extract-css-chunks universal-component react-universal. Complete with full
chunking, code splitting, real and true hot module reloading. Compatible with faceyspacey universal
code splitting and server-side rendering.

BREAKING CHANGE: EVERYTHING! This its a complete rewrite. Top to bottom!! This is a major change to
the API and Loader. It will intergrate with universal without a issue and  IT DOES NOT RELY ON
UNIVERSAL COMPONENTS.

fix #60, re #36 #47 #51
…otfiles

Staging back in stuff to be deleted in hopes of reducing the size of the inital PR. Housekeeping on dotfiles and such

Adding the ability to prepack install from git directly
Fixed issues with namespacing that was causing compile issue in near production systems
Removing the old tests and implementing the new ones, we are missing some coverage
Linting the whole app so its less of a pain to use commitizen
Using a version of normalize-url which is too new and could be causing issues
New docs on implementation, API, Reasons for updateing. Currently a WIP
removing old JS files from the previous implementation, added yarn, cleaned up package deps a little
Notes on how to install a the package via a git branch
Testing collapsable summery block in order to hide the old documentation during beta/i can finish
updating it
Fixing bug where loader broke due to iteration over an object key that was a string and not an array
[WIP] Migrate Webpack 4 support branch
You can now install webpack 4 support via @next!!!!!!! Enjoy!
Adding myself to the contributors list in npm packages.
…loaders

Before adding hot reloading to the loader stack, make sure the build has some reference to hot
reloading either in the entry-points or devServer
feat(src/index.js): Check for hot reloading before adding hot loaders

Before adding hot reloading to the loader stack, make sure the build has some reference to hot
reloading either in the entry-points or devServer
Mergeing the new documentation with the old for a more concise read. Updating the example code
and the perks of our plugin
Adding collapsible content blocks to some of the longer topics, just displaying the hard hitting info
Finally extracted all relevant documentation.

Still needs some formatting
More stats added
Fixing them
Only attempt to inject HOT if in development, as a safety to production builds
@ScriptedAlchemy ScriptedAlchemy self-assigned this Jun 2, 2018
@ScriptedAlchemy ScriptedAlchemy modified the milestone: Update Docs Jun 2, 2018
@ScriptedAlchemy ScriptedAlchemy changed the title Webpack 4 Support feat(*): Webpack 4 Support for Universal CSS Chunks Jun 2, 2018
@ScriptedAlchemy
Copy link
Collaborator Author

I need to test this with the rest of universal and start pushing those for PR if needed

const isHOT = isHMR(compiler);

if (isHOT && compiler.options.module && compiler.options.module.rules) {
const updatedRules = compiler.options.module.rules.reduce((rules, rule) => {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@faceyspacey any ideas man. Its stable but looks off to me

Copy link
Owner

Choose a reason for hiding this comment

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

what looks off? its automatically adding the hotloader if its using the css loader.

Choose a reason for hiding this comment

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

Essentially yes, is this the most optimal method of accessing the compiler's loaders? Other than that, im fine with it. Just checking if you know about something like prependLoader. If not then all good

Copy link
Owner

Choose a reason for hiding this comment

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

na, i've seen this pattern of rewriting the rules at least once or twice before.

Copy link
Owner

@faceyspacey faceyspacey left a comment

Choose a reason for hiding this comment

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

dizzam, so basically is this HMR added to mini-extract? is there stuff that was added that doesnt make sense in mini-extract? it's very nice to have it under our roof, but im concerned that perhaps at the end of the day this belongs under the mini extract roof. Is there stuff here they're likely not to want (which by the way is the only reason I forked last time, and very likely a possibility again)? Can you describe in detail how this differs from mini extract?

@faceyspacey
Copy link
Owner

faceyspacey commented Jun 4, 2018

oh, and if it's not clear, FUCKIN ROUND OF APPLAUSE! Well done @zackljackson

@ScriptedAlchemy
Copy link
Collaborator Author

So I was thinking about opening a PR back to mini-css extract - but theres a lot of people who already use and depend on our repo. It would be good to give it a webpack 4 upgrade, so the users can just update.

I'd also like to keep a solution under our domain in the event that I need more than mini-css can offer.
Honestly I can't think of a good reason right now, but it would be nice to keep a heavily depended upon plugin updated.

I do want to open this to mini-css, but id also like to release it here first

@faceyspacey
Copy link
Owner

ok. proceed. all this stuff is intended for cross-polination anyway. this can be the breeding ground. ..but also, i think mini extract itself is a stopgap and webpack is supposed to have full built-in support for css or something. in other words: webpack's css solution is likely to change, so i think it's a good thing that we stay steady continuing to fulfill our traditional role.

@ScriptedAlchemy
Copy link
Collaborator Author

Agreed. Ill open a PR to them soon - but as you said mini-css is totally a stopgap. It'll be good to maintain control of our architecture till a stable replacement is made ready in webpack

@ScriptedAlchemy ScriptedAlchemy merged commit c542197 into master Jun 4, 2018
@ScriptedAlchemy ScriptedAlchemy deleted the webpack-4 branch October 2, 2018 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

webpack 4 support
3 participants