rollup-plugin-postcss ( PostCSS plugin postcss-noop-plugin requires PostCSS 8. Migration guide for end-users:)

时间:2021-03-11 17:44:49   收藏:0   阅读:525
解决办法:
将 autoprefixer 降级为 8.0.0
 
1. 安装 autoprefixer 插件
yarn add autoprefixer@8.0.0

  

2. 修改rollup.config.js文件
import fs from ‘fs‘
import path from ‘path‘
import json from ‘@rollup/plugin-json‘
import vue from ‘rollup-plugin-vue‘
import postcss from ‘rollup-plugin-postcss‘
import { terser } from ‘rollup-plugin-terser‘
import { nodeResolve } from ‘@rollup/plugin-node-resolve‘

const isDev = process.env.NODE_ENV !== ‘production‘

// 公共插件配置
const plugins = [
vue({
// Dynamically inject css as a <style> tag
css: true,
// Explicitly convert template to render function
compileTemplate: true
}),
json(),
nodeResolve(),
postcss({
// 把 css 插入到 style 中
// inject: true,
// 把 css 放到和js同一目录
extract: true,
plugins: [
   require(‘autoprefixer‘)({ overrideBrowserslist: [‘> 0.15% in CN‘] }) // 自动添加css前缀
]
})
]

  

原文:https://www.cnblogs.com/gqx-html/p/14518399.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!