catamphetamine / universal-webpack

Isomorphic Webpack: both on client and server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Maybe remove fake-style-loader

ignatevdev opened this issue · comments

It doesn't embed CSS but only exports the identifier mappings.

Which means it won't work when one is not using CSS modules?

Ok, I'll be accepting a Pull Request for this one if it works both with non-css-modules and css-modules.
My guess is that in the case of non-css-modules style-loader would be simply dropped, and for css-modules it would be dropped and also css-loader would be replaced with css-loader/locals.
The detection of css-modules could be done by analysing css-loader parameters.

I think that isomorphic-style-loader might solve this issue as a drop in replacement for style-loader. It brings with it extra options as well, but I've tried using it for isomorphic apps before and it seems to work and brings with it the added benefit of not outputting several copies of css files.

Regardless of how many styles components there are in the app.js bundle, only critical CSS is going to be rendered on the server inside the section of HTML document. Critical CSS is what actually used on the requested web page, effectively dealing with FOUC issue and improving client-side performance. CSS of the unmounted components will be removed from the DOM.

This seems good.
I think isomorphic-style-loader could be a viable replacement for fake-style-loader given it has that feature.
But since fake-style-loader is currently working and doing its job I don't see a need for the replacement.
And also isomorphic-style-loader has about 30 issues open so that's another thing to look at.

@NSLS I released version 0.3.x removing fake-style-loader in favour of css-loader/locals.
Try it.

@NSLS
It now also doesn't emit any assets on the server side (it's an optimization feature).

@halt-hammerzeit I will definitely check it out, thanks!