import * as fs from 'fs' import * as path from 'path' /** 根据根目录下是否存在 style lint 配置, 判断是否启用style lint */ const isEnableStyleLint: boolean = fs.existsSync(path.join(process.cwd(), '.stylelintrc.js')) /** 创建 vue 插件配置 */ export const createVuePluginConfig = () => { return { /** 是否启用保存时, style lint 校验 */ lintStyleOnBuild: isEnableStyleLint, /** style lint 样式修复 */ stylelint: isEnableStyleLint ? { fix: true } : null } }