question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

postcss.config.js plugins causing exception

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
BasilPPcommented, Oct 2, 2019

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!

0reactions
mrmckebcommented, Oct 20, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: PostCSS plugin tailwindcss requires PostCSS 8
I tried to uninstall postcss and tailwindcss but it does not work. Need help. Module build failed (from ./node_modules/postcss-loader/src/index.
Read more >
Advanced Features: Customizing PostCSS Config - Next.js
Warning: When you define a custom PostCSS configuration file, Next.js completely disables the default behavior. Be sure to manually configure all the features ......
Read more >
Resolve | webpack
A list of additional resolve plugins which should be applied. It allows plugins such as DirectoryNamedWebpackPlugin . webpack.config.js module.exports = { // ...
Read more >
this version of postcss-preset-env is not optimised to work with ...
After editing path to css in index.html, angular.json and angular-cli.json during project building I receive this error: "Unknown error from PostCSS plugin.
Read more >
Running PostCSS - ESM loader Error - support - HUGO
Further details, if they are helpful are that I have all npm modules installed globally, not locally and was using a standard “postcss.config.js”....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found