Nuxtjs2.15+ postcss-px-to-viewport报warining

一段时间没有开发Nuxt项目,再启动的时候,已经会报warning了。
WARN You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on https://www.postcss.parts/ and use them in postcss.config.js.

项目不忙的时候,终于可以来解决一下。把之前的配置换掉基本上就解决了。

1. 使用@nuxt/postcss8

npm i @nuxt/postcss8 -D

2.nuxt.config.js

buildModules: [
    '@nuxt/postcss8',
  ],

3.把build里面的参数改一下

 postcss: {
      plugins: {
        'postcss-px-to-viewport': 你的配置,
      },
      preset: {
        autoprefixer: {
          grid: true,
        },
      },
    },

4. postcss-px-to-viewport的warning解决

https://github.com/xian88888888/postcss-px-to-viewport-8-plugin

posted @ 2022-06-02 14:34  e.e.p  阅读(837)  评论(0编辑  收藏  举报