webpack-contrib / stylelint-webpack-plugin

A Stylelint plugin for webpack
MIT License
426 stars 72 forks source link

Stylelint v16 Breaks Plugin in Webpack #342

Closed goxmedia closed 9 months ago

goxmedia commented 11 months ago

Actual Behavior

Upgraded to Stylelint v.16. Upon build, received the following error:

The CommonJS Node.js API is deprecated. See https://stylelint.io/migration-guide/to-16 [webpack-cli] HookWebpackError: formatter is not a function

Expected Behavior

Build should have completed as typical and as currenty confitured through .styelintrc.js.

How Do We Reproduce?

Upgrade package.json to use Styleline v16.0.1. Run build.

Please paste the results of npx webpack-cli info here, and mention other relevant information

System: OS: macOS 14.1.2 CPU: (20) arm64 Apple M1 Ultra Memory: 69.48 GB / 128.00 GB Binaries: Node: 18.18.2 - ~/.nvm/versions/node/v18.18.2/bin/node Yarn: 1.22.19 - ~/Sites/themes/ghost/os-ghost/node_modules/.bin/yarn npm: 9.8.1 - ~/.nvm/versions/node/v18.18.2/bin/npm Browsers: Chrome: 120.0.6099.71 Safari: 17.1.2 Packages: babel-loader: ^9.1.3 => 9.1.3 browser-sync-webpack-plugin: ^2.3.0 => 2.3.0 copy-webpack-plugin: ^11.0.0 => 11.0.0 css-loader: ^6.8.1 => 6.8.1 css-minimizer-webpack-plugin: ^5.0.1 => 5.0.1 eslint-webpack-plugin: ^4.0.1 => 4.0.1 image-minimizer-webpack-plugin: ^3.8.3 => 3.8.3 postcss-loader: ^7.3.3 => 7.3.3 stylelint-webpack-plugin: ^4.1.1 => 4.1.1 svgo-loader: ^4.0.0 => 4.0.0 ts-loader: ^9.5.1 => 9.5.1 webpack: ^5.89.0 => 5.89.0 webpack-bundle-analyzer: ^4.10.1 => 4.10.1 webpack-cli: ^5.1.4 => 5.1.4 webpack-messages: ^2.0.4 => 2.0.4 webpackbar: ^5.0.2 => 5.0.2

evenstensberg commented 11 months ago

Provide a reproduction repo please

alexander-akait commented 11 months ago

I think we don't support stylelint v16 right now. You can send a PR and help us, thank you

/cc @ricardogobbosouza do you have time to help us?

ricardogobbosouza commented 11 months ago

@alexander-akait Of course, I will do

ricardogobbosouza commented 10 months ago

I was analyzing and saw that stylelint was rewritten in ESM @alexander-akait Does webpack support plugins ESM?

goxmedia commented 10 months ago

Thanks for the help. I had to disable it for now in my Webpack config and will use the VSC plugin for now.

chadlwilson commented 10 months ago

Interestingly (and this is probably unhelpful to most folks here), the older plugin version 2.5.0 seems to be working OK with stylelint 16 on webpack 4, despite it complaining about the peer dependency and stylelint complaining The CommonJS Node.js API is deprecated. See https://stylelint.io/migration-guide/to-16.

alexander-akait commented 10 months ago

@ricardogobbosouza You can use dynamic import(...) to load ESM version, we use it in many plugins

alexander-akait commented 10 months ago

But yeah webpack supports ESM configurations, but I prefer above right now