postcss.config.js plugins causing exception
See original GitHub issueDescribe the bug
When using this plugin, it throws an exception when a postcss.config.js file with plugins is present.
Error Message:
[typescript-plugin-css-modules] Stack trace: Error: Use process(css).then(cb) to work with async plugins
To Reproduce
Include a postcss.config.js file with any of these plugins:
• postcss-import
• postcss- url
• postcss-preset-env
• cssnano
Expected behavior Exception to not be thrown.
Desktop (please complete the following information): OS - windows
Additional context
I’ve traced the error to a line in DtsSnapshotCreator.ts:
const processedCss = processor.process(transformedCss);
Now, in my scenario, processor.process(transformedCss) is returning a Promise and a simple solution I found was to await the promise returned by processor.process(transformedCss).
But I’m not sure if the reason a Promise is being returned in my case is that:
- there is something wrong in my setup?
- one of the plugins I’m using is forcing
processor.process(transformedCss)to behave in an async fashion? I noticed that there is code in theindex.tsfile to filter out thepostcss-mixinsplugin as it might be async. Do more plugins need to be excluded in this way?
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)

Top Related StackOverflow Question
The second option is absolutely perfect! (and it solves #47 very nicely too)
Thank you so much to you both for spending so much time looking into this, its very much appreciated!
Hi @BasilPP, we’ve just released v2.0.0 which enables custom renderers and passing through options to renderers.
Release notes and migration steps can be found here: https://github.com/mrmckeb/typescript-plugin-css-modules/releases/tag/v2.0.0
Please let me know if you have any other issues or feedback! And thanks for your patience.