RJWadley / stylelint-no-unsupported-browser-features

Disallow features that aren't supported by your target browser audience.
426 stars 20 forks source link

Error using 8.0.0 with Stylelint 16.1.0 #297

Open ateufel opened 10 months ago

ateufel commented 10 months ago

When i try to use this combination of versions, I get the following error when trying to lint my CSS:

Error [ERR_REQUIRE_ESM]: require() of ES Module .../node_modules/stylelint-no-unsupported-browser-features/lib/index.js from .../node_modules/stylelint/lib/augmentConfig.js not supported.
Instead change the require of index.js in .../node_modules/stylelint/lib/augmentConfig.js to a dynamic import() which is available in all CommonJS modules.

The error appears to happen in Line 334 of augmentConfig.js, when it tries to require the plugin, which seems to be an ESM. I cleared my node_modules folder and rebuilt it with yarn, but it did not solve the issue. Does it work for anyone with those versions?

RJWadley commented 9 months ago

so far I haven't been able to reproduce this with stylelint 16, but that's the expected behavior if you use version 8 with stylelint 15.

could you provide a minimal reproduction of the issue to debug?

xsq007 commented 5 months ago

Version 7.0.0 works well with stylelint 15, but 7.1.0 doesn't work. Same "ERR_REQUIRE_ESM" error.

RJWadley commented 5 months ago

@xsq007 from NPM: version 7.1 is the same as 8.0, and was incorrectly published under the wrong version

so yeah, don't use that version. my apologies for that! use 7.0.0 or 8+

budarin commented 5 months ago

try to use .mjs and esm syntax for your config it works for me

certainlyakey commented 4 months ago

try to use .mjs and esm syntax for your config it works for me

Didn't help me unfortunately - switched to mjs and ESM but it's still the same error.