我如何解决"Greetings, time traveller. We are in the golden age of prefix-less CSS, where Autoprefixer is no longer needed for your stylesheet."?

How do I solve "Greetings, time traveller. We are in the golden age of prefix-less CSS, where Autoprefixer is no longer needed for your stylesheet."?

在我的 Next.JS 应用程序中,我在 _app.js 中导入我的样式表,如下所示:

import '../public/css/Index.css';

Index.css 包含这个:

.index-container {
    margin: 20px auto 0;
}

如何解决错误信息:

./src/public/css/Index.css (./node_modules/css-loader/dist/cjs.js??ref--5-oneOf-5-1!./node_modules/next/dist/compiled/postcss-loader??__nextjs_postcss!./src/public/css/Index.css) Warning

Greetings, time traveller. We are in the golden age of prefix-less CSS, where Autoprefixer is no longer needed for your stylesheet.

这是一个问题,因为 browserslistpostcss-preset-envv9.4.4 的捆绑版本不兼容。

更新到 v9.5.0 应该可以解决问题。

您的问题可以通过应用以下代码package.json得到解决:

 "browserslist": {
    "production": [
      ">0.3%",
      "not ie 11",
      "not dead", 
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version",
      ">0.3%",
      "not ie 11",
      "not dead", 
      "not op_mini all"
    ]
  }

完成这些更改后重新启动服务器。您将不会再收到此警告。

我必须按如下方式更改生产项目和开发项目,这很有效。

"browserslist": {
  "production": [
    ">0.3%",
    "not ie 11",
    "not dead",
    "not op_mini all"
  ],
"development": [
    ">0.3%",
    "not ie 11",
    "not dead",
    "not op_mini all"
  ]
},

更新所有已安装的软件包解决了这个问题。

npx browserslist --update-db 为我工作