michalkvasnicak / babel-plugin-css-modules-transform

Extract css class names from required css module files, so we can render it on server.
MIT License
326 stars 54 forks source link

babel-plugin-css-modules-transform and css-loader create different class names #94

Closed b-ponomarenko closed 6 years ago

b-ponomarenko commented 6 years ago

I have repo (https://github.com/b-ponomarenko/react-boilerplate) where I try to compile css on server using babel-plugin-css-modules-transform (I have the same generateScopedName setting) and I note, that when I run compiling process separately on client and on server I have different hash names, example: for:

.foo {
  background: red;
}

server: { foo: ‘Foo__foo__-Pwji’ } client: {foo: "Foo__foo__1ZdkW"}

When I run this processes together hash name from server appears to client bundle, and style-loader don't create styles in runtime. What could be wrong?

edwardfxiao commented 5 years ago

@b-ponomarenko what fix this?

MaheshSinghSawant commented 5 years ago

im facing the same issue. @b-ponomarenko how did you resolve this?

edwardfxiao commented 5 years ago

@MaheshSinghSawant Take a look at my solution https://github.com/webpack-contrib/css-loader/issues/877#issuecomment-514461524