Skip to content

Commit 1985329

Browse files
committed
refactor: 🔥 migrate the postcss configuration
1 parent 4319a56 commit 1985329

File tree

5 files changed

+43
-36
lines changed

5 files changed

+43
-36
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
"editor.codeActionsOnSave": {
55
"source.fixAll.eslint": true
66
}
7-
}
7+
}

package.json

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"plop": "plop"
1616
},
1717
"dependencies": {
18-
"@types/lodash-es": "^4.17.6",
1918
"@vant/touch-emulator": "^1.4.0",
2019
"@vant/use": "^1.4.3",
2120
"axios": "^1.2.0",
@@ -37,12 +36,14 @@
3736
"@babel/preset-env": "^7.20.2",
3837
"@babel/preset-typescript": "^7.18.6",
3938
"@babel/register": "^7.18.9",
39+
"@types/lodash-es": "^4.17.6",
4040
"@types/node": "^18.11.9",
4141
"@types/nprogress": "^0.2.0",
4242
"@types/store": "^2.0.2",
4343
"@vitejs/plugin-legacy": "^2.3.1",
4444
"@vitejs/plugin-vue": "^3.2.0",
4545
"@vitejs/plugin-vue-jsx": "^2.1.1",
46+
"@yuo/postcss-px2vw": "^1.0.5",
4647
"autoprefixer": "^10.4.13",
4748
"babel-plugin-module-resolver": "^4.1.0",
4849
"commitizen": "^4.2.5",
@@ -55,8 +56,6 @@
5556
"mockjs": "^1.1.0",
5657
"path-to-regexp": "^6.2.1",
5758
"plop": "^3.1.1",
58-
"postcss": "^8.4.19",
59-
"postcss-px-to-viewport-8-plugin": "^1.1.5",
6059
"rollup": "^3.5.0",
6160
"rollup-plugin-visualizer": "^5.8.3",
6261
"signale": "^1.4.0",
@@ -70,6 +69,13 @@
7069
"vitest": "^0.25.3",
7170
"vue-tsc": "^1.0.9"
7271
},
72+
"pnpm": {
73+
"peerDependencyRules": {
74+
"ignoreMissing": [
75+
"postcss"
76+
]
77+
}
78+
},
7379
"config": {
7480
"commitizen": {
7581
"path": "./node_modules/cz-emoji-chinese"

pnpm-lock.yaml

Lines changed: 19 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

postcss.config.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

vite.config.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ import vue from '@vitejs/plugin-vue'
1111
import legacy from '@vitejs/plugin-legacy'
1212
import vueJsx from '@vitejs/plugin-vue-jsx'
1313

14+
import px2vw from '@yuo/postcss-px2vw'
15+
import autoprefixer from 'autoprefixer'
16+
1417
import { viteVConsole } from 'vite-plugin-vconsole'
1518
import mock from './build/mock/createMockServer'
1619

@@ -73,6 +76,17 @@ export default ({ command, mode }: ConfigEnv): UserConfig => {
7376
}),
7477
],
7578

79+
css: {
80+
postcss: {
81+
plugins: [
82+
autoprefixer(),
83+
px2vw({
84+
viewportWidth: 375,
85+
}),
86+
],
87+
},
88+
},
89+
7690
build: {
7791
cssCodeSplit: false,
7892
chunkSizeWarningLimit: 2048,

0 commit comments

Comments
 (0)