webpack-contrib / postcss-loader

PostCSS loader for webpack
MIT License
2.86k stars 211 forks source link

fix: support ESM version of `postcss.config.js` #614

Closed alexander-akait closed 1 year ago

alexander-akait commented 1 year ago

This PR contains a:

Motivation / Use-Case

Allow to load ESM configuration, tests are impossible due bugs and unstable ESM working in jest, so tested manually

Breaking Changes

No

Additional Info

Fixes https://github.com/webpack-contrib/postcss-loader/issues/613

codecov[bot] commented 1 year ago

Codecov Report

Base: 93.14% // Head: 89.33% // Decreases project coverage by -3.80% :warning:

Coverage data is based on head (c95cd70) compared to base (f1729f8). Patch coverage: 44.44% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #614 +/- ## ========================================== - Coverage 93.14% 89.33% -3.81% ========================================== Files 5 5 Lines 321 347 +26 Branches 106 113 +7 ========================================== + Hits 299 310 +11 - Misses 20 34 +14 - Partials 2 3 +1 ``` | [Impacted Files](https://codecov.io/gh/webpack-contrib/postcss-loader/pull/614?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webpack-contrib) | Coverage Δ | | |---|---|---| | [src/utils.js](https://codecov.io/gh/webpack-contrib/postcss-loader/pull/614/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webpack-contrib#diff-c3JjL3V0aWxzLmpz) | `85.10% <44.44%> (-5.33%)` | :arrow_down: | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webpack-contrib). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=webpack-contrib)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

its-me-VOID commented 10 months ago

postcss.config.mjs silently fail, as if the config wasn't specified. I think this PR didn't bring support of esm module.

its-me-VOID commented 10 months ago

@alexander-akait cosmiconfig from version 8.2.0 support ESM config without patch, with the Async APi https://github.com/cosmiconfig/cosmiconfig#loading-js-modules

alexander-akait commented 9 months ago

@its-me-VOID

postcss.config.mjs silently fail, as if the config wasn't specified. I think this PR didn't bring support of esm module.

Can you provide reproducible test repo?