postcss / autoprefixer

Parse CSS and add vendor prefixes to rules by Can I Use
https://twitter.com/autoprefixer
MIT License
21.57k stars 1.25k forks source link

caniuse-lite auto-updater v1.0.30001394 deletes css-unicode-bidi which breaks autoprefixer build #1476

Closed jz-dot-meng closed 1 year ago

jz-dot-meng commented 1 year ago

Ran yarn on a new branch of a Next.js project that used tailwind + postcss/autoprefixer with a basic empty postcss.config.js:

module.exports = {
  plugins: {
    tailwindcss: {},
    autoprefixer: {},
  },
};

This error came up while trying to build the dev environment:

error - ./node_modules/next/dist/build/webpack/loaders/css-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[1]!./node_modules/next/dist/build/webpack/loaders/postcss-loader/src/index.js??ruleSet[1].rules[2].oneOf[4].use[2]!./src/styles/Home.module.css
Error: Cannot find module 'caniuse-lite/data/features/css-unicode-bidi'
Require stack:
- /Users/***/Documents/***/client-interface/node_modules/autoprefixer/data/prefixes.js
- /Users/***/Documents/***/client-interface/node_modules/autoprefixer/lib/autoprefixer.js
- /Users/***/Documents/***/client-interface/node_modules/next/dist/build/webpack/config/blocks/css/plugins.js
- /Users/***/Documents/***/client-interface/node_modules/next/dist/build/webpack/config/blocks/css/index.js
- /Users/***/Documents/***/client-interface/node_modules/next/dist/build/webpack/config/index.js
...

and looking into the node_modules files, it looks like canisuse-lite had a recent auto-update that removed the css-unicode-bidi file breaking compatibility

nicholaszuccarelli commented 1 year ago

Same error happening with me this morning too. Can't run my project now.

EightPool commented 1 year ago

I had the same issue. It works if I override caniuse-lite version

"overrides": { "caniuse-lite": "1.0.30001393" },

jz-dot-meng commented 1 year ago

looks like "autoprefixer":"^10.4.9" now fixes the issue!

nicholaszuccarelli commented 1 year ago

It works if I override caniuse-lite version

Perfect, worked for me. Unfortunately the package I am using on my project uses Autoprefixer v9.8.1 so upgrading to v10 wasn't a solution for me :)

ai commented 1 year ago

Dublicate https://github.com/postcss/autoprefixer/issues/1475