MoOx/postcss-cssnext

Module build failed: BrowserslistError: Unknown browser major

Closed this issue · 3 comments

I am using nuxt-community express-template with bootstrap@4.0.0. I updated the nuxt version of the express-template to nuxt 1.4.0 which depends on postcss-cssnext@3.1.0. Somehow autoprefixer@^7.1.1 that the latest postcss-cssnext is using may have a bug with browserslist@^2.2.2. They does not support one of the query defined in the browserslist of bootstrap:

last 1 major version

An error occurs during nuxt build:

Module build failed: BrowserslistError: Unknown browser major

Remove the last 1 major version from package.json of bootstrap works. Update the autoprefixer in postcss-cssnext to the latest version also works. I guess the problem is between the autoprefixer and browserslist that the later one does not recognize the query.

autoprefixer has to be updated to the newer version to make this work.

For now, I just modify the yarn.lock file to force postcss-cssnext to use autoprefixer@8.2.0. If you are using npm, you can use shrinkwrap.

Possibly resolved by #445

MoOx commented

postcss-cssnext has been deprecated in favor of postcss-preset-env. Read more at https://moox.io/blog/deprecating-cssnext/