-
-
Notifications
You must be signed in to change notification settings - Fork 470
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
Using style-loader with pure V8 engine. #114
Comments
After looking at the source, is it possible to configure web-pack to override the import of the file |
I was able to fix this by using the extract-text-webpack-plugin for my server script that runs in a pure V8 environment. |
I have this exact same problem. Is there any way that it could be fixed in style-loader while leaving the CSS inline? An example error:
|
@dpwrussell So I'm running into the same issue trying to achieve universal rendering. I've seen some implementations use the https://github.com/erikras/react-redux-universal-hot-example |
@dpwrussell Actually, search the code, it seems that they do use the |
@JonathanZWhite Yeah, I have that in place as a temporary solution, but would prefer not to! |
Hey guys, I figured out how this is too be done correctly. Use For the client, just use |
@pauldotknopf I don't see how that solves the problem, if I do that then my app will just not have any styles as they are not included in the javascript, nor are they built into a standalone CSS file like they would be with I could of course use |
This discussion is about using a V8 engine, which is essentially server-side rendering. The server-side script, you will use Then, use You have to generate two separate scripts. One for server rendering, and one for client rendering. |
@dpwrussell I think @pauldotknopf might have a point. Taking a quick look at the webpack config he linked, it seems they have one config for their server and one for their client. Personally, I resolved it by looking at isomorphic-flux-boilerplate. So it's not super clean but they have an global variable This approach helped me understand how some people are doing it. For actual implementation detail, I look at https://github.com/erikras/react-redux-universal-hot-example. It seems like they define a global Edit: Also take a look at this Github issue webpack-contrib/sass-loader#157 |
I do have two configurations, one for the client and one for the server. The client is fine and the css is included in the javascript and loaded with The server-build with The reason that @pauldotknopf example works is because the client part of the build uses |
Yes, it is assumed that you are using an external css. How do you expect the server to render css with a full GET HTML request? Embedded into a <style></style> tag? I wouldn't recommend that. Just leave the style as an external css. Doing otherwise feels like we are going against the grain. |
Yes, that was pretty much my point. I have just come across this, which is along the lines I was imagining: https://github.com/halt-hammerzeit/webpack-isomorphic-tools, but it seems extremely complex. |
I think this issue is the same as #109. My workaround there is using https://github.com/kriasoft/isomorphic-style-loader and just replace loaders: 'style-loader!...' by loaders: 'isomorphic-style-loader!...' |
This is not complete or production ready, as we released it just a few days ago, but might interest you: https://github.com/iheartradio/node-style-loader it behaves like style-loader but for the server-side (while isomorphic-style-loader differs) |
|
I am working on a project that uses an embedded V8 engine to render markup (universal rendering). We use webpack to generate the server-side script that will be loaded into the V8 environment.
We are using this loader.
When running the script compiled from webpack in the client, the
styles
variable get's built correctly with valid properties.However, when I run that same compiled script inside of my V8 instance, I get some "window" and "document" not defined errors. I would expect there to be support for running the webpack compiled script in a node or V8 environment. The
require("./containers/App/Appcss");
winds up returning an empty json object because of the errors.Is it possible to use style-loader to return a json object representation of the style-sheet only, and not attempt to add styles to the DOM?
The text was updated successfully, but these errors were encountered: