nuxt
nuxt copied to clipboard
postcss插件使用时不生效,提示请使用 postcss.config.js进行配置,配置之后nuxt提示请在nuxt.config.js中配置postcss,导致无法配置
Versions
- nuxt: v2.15.7
- node: v16.14.2
Reproduction
nuxt.config.js
{ build:{ postcss: { // Add plugin names as key and arguments as value // Install them before as dependencies with npm or yarn plugins: { // Disable a plugin by passing false as value 'postcss-url': false, 'postcss-nested': {}, 'postcss-responsive-type': {}, 'postcss-hexrgba': {}, 'postcss-pxtorem': { remUnit: 75, remPrecision: 2, selector_black_list: ['vant'], exclude: '/node_modules|vant/i' } }, preset: { // Change the postcss-preset-env settings autoprefixer: { grid: true } } } }
提示:
You did not set any plugins, parser, or stringifier. Right now, PostCSS does nothing. Pick plugins for your case on h
ttps://www.postcss.parts/ and use them in postcss.config.js.
添加 postcss.config.js后,提示
Please use build.postcss in your nuxt.config.js instead of an external config file. Support for such files will be re
moved in Nuxt 3 as they remove all defaults set by Nuxt and can cause severe problems with features like alias resolving ins
ide your CSS.
{ build:{ postcss: { // Add plugin names as key and arguments as value // Install them before as dependencies with npm or yarn plugins: { // Disable a plugin by passing false as value 'postcss-url': false, 'postcss-nested': {}, 'postcss-responsive-type': {}, 'postcss-hexrgba': {}, 'postcss-pxtorem': { remUnit: 75, remPrecision: 2, selector_black_list: ['vant'], exclude: '/node_modules|vant/i' } }, preset: { // Change the postcss-preset-env settings autoprefixer: { grid: true } } } }