丘比特
丘比特
  • 发布:2024-07-10 20:54
  • 更新:2024-07-10 20:54
  • 阅读:206

uniapp 小程序prettier代码格式化postcss无法兼容

分类:uni-app

在进行git hooks的husky时候 postcss只有大于8的版本才可以校验通过

  1. 问题1:

1.1、postcss@8编译提示错误文案:
Error: PostCSS plugin postcss-uniapp-plugin requires PostCSS 8.
Migration guide for end-users:
https://github.com/postcss/postcss/wiki/PostCSS-8-for-end-users

1.2、postcss@8 代码自动格式化可以通过

  1. postcss@7 本地编译可以正常启动
    2.1、postcss@7 代码格式化提示:
    stylelint --fix --cache:
    TypeError: Class extends value undefined is not a constructor or null
    at Object.<anonymous> (/Users/xxx/Desktop/uniapp-demo/node_modules/postcss-scss/lib/nested-declaration.js:3:33)
    at Module._compile (/Users/xxx/Desktop/uniapp-demo/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (/Users/xxx/Desktop/uniapp-demo/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.<anonymous> /Users/xxx/Desktop/uniapp-demo/node_modules/postcss-scss/lib/scss-parser.js:4:25)
    at Module._compile (/Users/xxx/Desktop/uniapp-demo/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

依赖额文件如下:

"stylelint": "15.10.2",
"stylelint-config-prettier": "9.0.5",
"stylelint-config-rational-order": "0.1.2",
"stylelint-config-standard": "34.0.0",
"stylelint-config-standard-scss": "10.0.0",
"stylelint-order": "6.0.3",
"stylelint-prettier": "4.0.2",
"stylelint-scss": "5.3.0",

"postcss": "7.0.0",
"postcss-comment": "^2.0.0",
"postcss-html": "^1.5.0",
"postcss-loader": "7.0.0",
"postcss-scss": "^4.0.9",
"prettier": "2.8.8",
"pretty-quick": "2.0.0",

2024-07-10 20:54 负责人:无 分享
已邀请:

要回复问题请先登录注册