-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
Css module support is broken in 3.1.3 #296
Comments
Using object instead of true returns postcss({
modules: {
localsConvention: 'dashesOnly'
},
onlyModules: false
}) |
I've same issue, set postcss({
modules: {
generateScopedName: 'myapp_[name]_[local]'
},
extract: true,
autoModules: false
}) |
@katywings do you have an idea what could cause this? It seems like #292 is the culprit. |
@vladshcherbin How did you reproduce this issue? Whats the file name of the css file you are importing? Does it include
I could not reproduce this.
Yeah, because if you have autoModules enabled - which is the default :D - and your css file doesn't have a To answer the question in which cases a css file is interpreted as module: The description of #292 includes a detailed table of when a file is to be considered a css module. History about #292 / autoModules About Here is a quick output of many different cases which all worked fine imho:
ZIP which includes the top cases: rollup-postcss-test.zip You can run it with |
Thanks @katywings for the great explanation. @vladshcherbin any chance you can give us a demo project? |
I also got bit by this bug after upgrading my project from 3.1.1 to 3.1.8. I downgraded back to 311 and it started working again. I can also confirm that adding This is my plugin config: postcss({
extract: false,
modules: { scopeBehaviour: 'global' },
use: [ 'sass', [ 'prepend', { files: [ resolve('styles.scss') ] } ] ],
loaders: [
{
name: 'prepend',
test: /\.(scss)$/,
async process ({ code }) {
const { files = [] } = this.options;
const contents = await Promise.all(files.map((f) => fs.readFile(f), { encoding: 'utf8' }));
contents.push(code);
return { code: contents.join('\n\n'), map: undefined };
},
},
],
}), I think this may be the relevant change. This will cause |
Wow, it almost broke our release, good thing that tests caught this. After upgrading to |
Definitely a breaking change, shouldn't have been released as a bugfix. We are not using |
In 3.1.2 docs example works, imports in js return correct objects.
In 3.1.3 same code imports return
undefined
. From #292 there is newonlyModules
option I believe. Using it brings back correct objects.However, it's a breaking change, this option is not documented and I have no idea if using it is a correct workaround.
Would be awesome to see official solution to this one 🙏
The text was updated successfully, but these errors were encountered: