Description
Describe 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.ts
file to filter out thepostcss-mixins
plugin as it might be async.
Do more plugins need to be excluded in this way?