-
-
Notifications
You must be signed in to change notification settings - Fork 162
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
runtime resoluton won't work with composes #113
Comments
If I reinstall babel-plugin-react-css-modules, everything works fine. But if I change the class which was composed and compile the project again, this problem will happen. |
I have a similar problem when using composed classes. When the composed classes are in the global space it gets a bit worse and shows "undefined" for those composed classes. So there is a bit of a problem using composed classes. It's trying to resolve classNames after the already resolving. import "./styles.css" Will cause something like this for a composed class .example {
composes: btn from '../global.css'
} The resolved styles might be var styles = {
'example': 'styles-example-ASDEF btn'
}; The output will results in <SomeComponent className="styles-example-ASDEF undefined"/> This is because it can't resolve "btn" inside of the stylesheet context but should be looking it up inside of the composed stylesheet or leave it alone altogether. I.e. leave names it can't resolve. Not sure how to fix this. I switched to straight react-css-modules till then. |
This is a low-level issue with https://github.com/webpack-contrib/css-loader or more generally with https://github.com/css-modules/css-modules. |
This: <div class="reprodStyle_live-card_2j7Qr reprodStyle_four-col_2_FEw"></div> Cannot be the output of: <div styleName={type === 'article' ? 'article-card' : 'live-card'}> Where is the |
The
And it can't be removedas espected when |
This doesn't really make sense. Is the code repository public/ or could your re-create it in a sandbox? |
@gajus I'm sorry I just notice your reply after such a long time. I think this problem may be caused by
webpack.config.dev.js: {
test: /\.css$/,
use: [
require.resolve('style-loader'),
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 2,
localIdentName: '[name]_[local]_[hash:base64:5]',
modules: true,
camelCase: true,
},
},
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
],
},
},
],
}, babel:
|
Probably duplicate of: |
jsx
css:
I get this:
The 'search' class doesn't get added, and the 'four-col' which was composed before is still used.
My environment
The text was updated successfully, but these errors were encountered: