Closed moimael closed 8 years ago
As cq-prolyfill relies on computed styles and the DOM, I think you should exclude it from the server-side part.
Did you ever find a solution - I am running into the same problem with css-modules, post-css & react during a webpack build.
@RichOren to get rid of the window is not defined error
when using it in webpack:
postcss: function() {
return [
// ... other postcss plugins here
// (not sure if they should come before or after as I'm still struggling to get cq to work :( )
require('cq-prolyfill/postcss-plugin')();
];
}
not sure if they should come before or after as I'm still struggling to get cq to work :(
I think this depends the other plugins having problems with :container(...)
. Using cq-prolyfill/postcss-plugin
as the first plugin should work best in most cases.
@ausi do you mean listed first in the postcss plugins or loaded first (also not sure if there's a difference between the two with regards to the postcss webpack loader).
I've tried both and even with wrapping the container query with :global
, I'm still unable to trigger the query.
do you mean listed first in the postcss plugins or loaded first
I meant listed as the first PostCSS plugin, so that all your other PostCSS plugins come after it.
Do you have a reduced test case or a link to a page where it is not working?
@ausi Not at the moment, though I have gotten it to work correctly (the problem was initialization of the cqApi
object).
My current issue now is that reparse
and reevaluate
are being invoked before the components are fully built and mounted to the DOM, but I suspect that that is more of an issue with React than with this library. Thank you for your help!
Hi,
I try to use this component with react, css-modules and server-side rendering. But server side rendering won't work because of this error :
Any workaround ?
Thanks