-
Notifications
You must be signed in to change notification settings - Fork 144
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
I get a 'style._insertCss' is not a function error #149
Comments
What version of React are you using? I'm seeing a similar problem and wondering if it's related to changes in the React API. |
@tstirrat15 do you know what is something problem???? |
@XOneto9 meaning you are seeing the same problem? Does it happen when you bring up your dev environment, or is it only specific to the production build? Now I'm wondering if it's related to webpack and bundling. I've been having issues with the context API on react-redux, and there's an issue open here for that: reduxjs/react-redux#1202 |
Actually, looking at your code: //...
{
test: /\.css$/, // Looking for CSS
use: [
//...
import s from './App.scss'; // Looking for SCSS If you want to use SCSS, you need to use a loader that can handle it, and you need to have a rule in your webpack configuration that loads it. It wouldn't surprise me if you were just getting an empty object with your current configuration. |
@tstirrat15 and, I'm not sure that the Webpack has some trouble. because I use create-react-app v2.1.5 and that the sample project is not modified just basic sample. first time, I tried to isomorphic-syle-loader on the react app made by create-react-app, of cause not modified. but I have got a error which is above massage. I had been followed Guide so, I inserted code webpack, component of App, babel. if you have a chance you can check the code using a create-react-app(latest version) and then eject project. that's same my test project.(not modified anything) thanks! |
Do you have |
I feel like I'm getting a similar error...
This is using CRA and replacing App.jsx and App.css with the examples provided in the readme along with the required webpack changes. My hunch is it is something with the React context API. I'm on React 16.8.4 and isomorphic-style-loader 5.0.1 Any ideas? |
@mattdell Are you experiencing the issue on production? I'm having same issue with production and found a workaround. But its working fine on development version. |
Did you use following on the server side? const css = new Set(); // CSS for all rendered React components
insertCss = (...styles) => styles.forEach(style => css.add(style._getCss()));
<StyleContext.Provider value={{ insertCss }}> |
One thing to check as well is that you're not getting multiple versions of React in your code bundle. This library bundles its own copy of react, and the new react context API depends on React being a singleton. There's some troubleshooting info here. |
I use, but same error |
I use it for react ssr,first. on server render , I can get css,but on the client, it happens error: |
Hi, how can this be resolved. Thoughts? |
You have this problem because you did not add isomorphic-style-loader to your webpack client build. 1. You should eject your app and update config or 2. install react-app-rewired and add additional config for css or scss rules. You can play with it here https://github.com/VeXell/ssr/tree/created_with_react_scripts |
I met the error, too. You can solve it by use isomorphic-style-loade for client render instead of style-loader. |
Client needs to be configured,reference resources rules: [
{
test: /\.css?$/,
use: [
"isomorphic-style-loader",
{
loader: "css-loader",
options: {
importLoaders: 1,
esModule: false, // !!!important
modules: {
localIdentName: "[name]__[local]___[hash:base64:5]",
},
},
},
],
},
], |
Hi,
I use react to test with create-react-app v2.1.5
For serverside rendering with scss, css styles.
the app is applied to basic sample on create-react-app.
just eject and add code on the Webpack
also App.js
finally Index.js
that's it, What is miss ? could you please let me know what I miss.
thanks
The text was updated successfully, but these errors were encountered: