@dlzn-ui/vite-config 1.60.0 → 1.63.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autoImportStores.ts +1 -1
- package/commonConfig.ts +36 -0
- package/index.ts +5 -5
- package/package.json +9 -6
package/autoImportStores.ts
CHANGED
package/commonConfig.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { UserConfig } from 'vite'
|
|
2
|
+
import tailwindcss from '@tailwindcss/vite'
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
5
|
+
import browserslist from 'browserslist'
|
|
6
|
+
import { browserslistToTargets } from 'lightningcss'
|
|
7
|
+
import tailwindAutoReference from 'vite-plugin-vue-tailwind-auto-reference'
|
|
8
|
+
|
|
9
|
+
interface Options {
|
|
10
|
+
tailwindAutoReferenceEntry: string
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export default (options: Options): UserConfig => {
|
|
14
|
+
const { tailwindAutoReferenceEntry } = options
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
clearScreen: false, // 设为 false 可以避免 Vite 清屏而错过在终端中打印某些关键信息
|
|
18
|
+
css: {
|
|
19
|
+
lightningcss: {
|
|
20
|
+
// https://cn.vitejs.dev/config/shared-options#css-lightningcss
|
|
21
|
+
targets: browserslistToTargets(browserslist('>= 0.25%')),
|
|
22
|
+
},
|
|
23
|
+
transformer: 'lightningcss', // 开发/构建时怎么转译 CSS
|
|
24
|
+
},
|
|
25
|
+
plugins: [
|
|
26
|
+
tailwindAutoReference(tailwindAutoReferenceEntry), // It must be registered before tailwindcss() official plugin!
|
|
27
|
+
tailwindcss(),
|
|
28
|
+
vue({
|
|
29
|
+
// features: {
|
|
30
|
+
// optionsAPI: false, // 不能删掉,tdesign 内部使用到了
|
|
31
|
+
// },
|
|
32
|
+
}),
|
|
33
|
+
vueJsx(),
|
|
34
|
+
],
|
|
35
|
+
}
|
|
36
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type * as http from 'node:http'
|
|
2
2
|
import type { ConfigEnv, ProxyOptions, UserConfig } from 'vite'
|
|
3
3
|
import { posix, resolve } from 'node:path'
|
|
4
|
-
import baseConfigFn from '@dlzn-ui/vite-config-base'
|
|
5
4
|
import AutoImport from 'unplugin-auto-import/vite'
|
|
6
5
|
import ElementPlus from 'unplugin-element-plus/vite'
|
|
7
6
|
import Components from 'unplugin-vue-components/vite'
|
|
@@ -11,6 +10,7 @@ import { createHtmlPlugin } from 'vite-plugin-html'
|
|
|
11
10
|
import VueRouter from 'vue-router/vite'
|
|
12
11
|
import aliasElementPlus from './aliasElementPlus.ts'
|
|
13
12
|
import autoImportStoreList from './autoImportStores.ts'
|
|
13
|
+
import baseConfigFn from './commonConfig.ts'
|
|
14
14
|
import tDesignAutoImportResolve from './tDesignResolve.ts'
|
|
15
15
|
import vitePlugins from './vitePlugins.ts'
|
|
16
16
|
|
|
@@ -24,10 +24,6 @@ interface Options {
|
|
|
24
24
|
}
|
|
25
25
|
type UnwrapArrayable<T> = T extends Arrayable<infer U> ? U : never
|
|
26
26
|
|
|
27
|
-
export function needPort(target: string): boolean {
|
|
28
|
-
return target.startsWith('http://192.')
|
|
29
|
-
}
|
|
30
|
-
|
|
31
27
|
function bypass(
|
|
32
28
|
req: http.IncomingMessage,
|
|
33
29
|
res: http.ServerResponse | undefined,
|
|
@@ -46,6 +42,10 @@ function bypass(
|
|
|
46
42
|
}
|
|
47
43
|
}
|
|
48
44
|
|
|
45
|
+
function needPort(target: string): boolean {
|
|
46
|
+
return target.startsWith('http://192.')
|
|
47
|
+
}
|
|
48
|
+
|
|
49
49
|
export default (_env: ConfigEnv, options: Options): UserConfig => {
|
|
50
50
|
const { command, mode } = _env
|
|
51
51
|
const resolvePath = (p: string) => resolve(options.root, p)
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dlzn-ui/vite-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.
|
|
4
|
+
"version": "1.63.0",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -12,11 +12,16 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
+
"tailwindcss": "^4.3.3",
|
|
15
16
|
"vite": "^8.2.0"
|
|
16
17
|
},
|
|
17
18
|
"dependencies": {
|
|
18
19
|
"@plugin-web-update-notification/vite": "^2.1.3",
|
|
20
|
+
"@tailwindcss/vite": "^4.3.3",
|
|
19
21
|
"@tdesign-vue-next/auto-import-resolver": "^0.1.7",
|
|
22
|
+
"@vitejs/plugin-vue": "^6.0.8",
|
|
23
|
+
"@vitejs/plugin-vue-jsx": "^5.1.6",
|
|
24
|
+
"browserslist": "^4.28.8",
|
|
20
25
|
"rollup-plugin-visualizer": "^7.1.1",
|
|
21
26
|
"tinyglobby": "^0.2.17",
|
|
22
27
|
"unplugin-auto-import": "^21.1.0",
|
|
@@ -26,10 +31,8 @@
|
|
|
26
31
|
"vite-plugin-env-parse": "^1.0.15",
|
|
27
32
|
"vite-plugin-html": "^3.2.2",
|
|
28
33
|
"vite-plugin-imagemin": "^0.6.1",
|
|
29
|
-
"vue-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"@dlzn-ui/build-utils": "0.0.1",
|
|
33
|
-
"@dlzn-ui/vite-config-base": "0.0.1"
|
|
34
|
+
"vite-plugin-vue-tailwind-auto-reference": "^2.0.2",
|
|
35
|
+
"vue-router": "^5.2.0",
|
|
36
|
+
"@dlzn-ui/node-utils": "1.63.0"
|
|
34
37
|
}
|
|
35
38
|
}
|