Tag Archives: Posts

[Solved] Postcss Error: Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.

This error occurs when packaging with postcss:   Invalid options object. PostCSS Loader has been initialized using an options object that does not match the API schema.

I’ve been searching for information for a long time because the versions are incompatible,

Solution: create a new postcss.config.js file under the root directory

The file configuration is as follows

module.exports={
    plugins:[
        require("postcss-preset-env")
    ]
}

Then delete the options in webpack.config.js and package again.

The problem of error in adaptation of Vue using vant mobile terminal rem

Using vant to adapt REM to
any gate vant

If necessary  rem   It is recommended to use the following two tools for adaptation

postcss-pxtorem   Is a post CSS plug-in, used to convert PX units into REM units lib flexible   Used to set the REM reference value

npm install postcss-pxtorem --save-dev
npm i -S amfe-flexible

  Create a new postcss. Config. JS
in the root directory  

module.exports = {
    plugins: {
      'autoprefixer': {
        browsers: ['Android >= 4.0', 'iOS >= 8']
      },
      'postcss-pxtorem': {
        rootValue: 37.5,
        propList: ['*']
      }
    }
  }

Introduce main.js again

import 'amfe-flexible'

NPM run serve startup found an error

  Check that the package.json version is too high
“postcss pxtorem”:  “^ 6.0.0”,

Degraded version

npm i [email protected]

e.g. run serve 21551; 36816;