@dlzn-ui/vite-config 1.99.0 → 2.0.1
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/dist/index.mjs +25 -42
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import path, { basename, resolve, relative, posix } from 'node:path';
|
|
2
2
|
import AutoImport from 'unplugin-auto-import/vite';
|
|
3
3
|
import Components from 'unplugin-vue-components/vite';
|
|
4
|
-
import { loadEnv, mergeConfig } from 'vite';
|
|
4
|
+
import { normalizePath, loadEnv, mergeConfig } from 'vite';
|
|
5
5
|
import { parseLoadedEnv } from 'vite-plugin-env-parse';
|
|
6
6
|
import { createHtmlPlugin } from 'vite-plugin-html';
|
|
7
7
|
import VueRouter from 'vue-router/vite';
|
|
@@ -66,7 +66,6 @@ const dirs$1 = ["button", "card", "checkbox", "checkbox-group", "cron", "custom-
|
|
|
66
66
|
const optimizeDepsInclude = [
|
|
67
67
|
...dirs$1.map((str) => `dlzn-ui/components/${str}`),
|
|
68
68
|
"tdesign-vue-next/dist/tdesign.min.js",
|
|
69
|
-
"path-browserify",
|
|
70
69
|
"lodash-es",
|
|
71
70
|
"alova",
|
|
72
71
|
"alova/fetch",
|
|
@@ -77,29 +76,18 @@ const optimizeDepsInclude = [
|
|
|
77
76
|
"dayjs/plugin/customParseFormat.js",
|
|
78
77
|
"dayjs/plugin/isSameOrBefore.js",
|
|
79
78
|
"wordcloud",
|
|
80
|
-
"echarts/charts",
|
|
81
|
-
"echarts/components",
|
|
82
|
-
"echarts/core",
|
|
83
|
-
"echarts/renderers",
|
|
84
79
|
"@tdesign-vue-next/chat",
|
|
85
|
-
"vue-echarts",
|
|
86
80
|
"dompurify",
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"element-plus",
|
|
93
|
-
"element-plus/es/components/config-provider/style/css",
|
|
94
|
-
"element-plus/es/locale/lang/zh-cn",
|
|
95
|
-
"element-plus/es/components/date-picker/style/css",
|
|
96
|
-
"element-plus/es/components/scrollbar/style/css",
|
|
97
|
-
"color"
|
|
81
|
+
"dlzn-ui/hooks/useContextMenu/menu",
|
|
82
|
+
"dlzn-ui/plugins/directive",
|
|
83
|
+
"dlzn-ui/plugins/initialize",
|
|
84
|
+
"dlzn-ui/router",
|
|
85
|
+
"dlzn-ui/store"
|
|
98
86
|
];
|
|
99
87
|
|
|
100
88
|
const dirs = ["button", "card", "checkbox", "checkbox-group", "cron", "custom-page-list", "custom-page-table", "date-picker", "form", "gradient-text", "icon", "image", "image-viewer", "input", "input-number", "link", "overview", "page-list", "page-query", "page-table", "pagination", "popconfirm", "popup", "provider", "radio-group", "range-input", "scrollbar", "select", "select-sys-user", "slider", "switch", "tab-panel", "table", "tag", "tag-input", "textarea", "tree", "tree-select", "upload"];
|
|
101
89
|
const tDesignAutoImportResolve = (options) => {
|
|
102
|
-
const {
|
|
90
|
+
const { root } = options;
|
|
103
91
|
const autoImportComponentsSubFolderFiles = globSync("src/components/autoImport/*/Index.vue", {
|
|
104
92
|
cwd: root
|
|
105
93
|
});
|
|
@@ -131,12 +119,7 @@ const tDesignAutoImportResolve = (options) => {
|
|
|
131
119
|
resolveIcons: false
|
|
132
120
|
// 禁用 https://tdesign.tencent.com/icons TDesign 图标独立站点 的图标
|
|
133
121
|
}).resolve(name);
|
|
134
|
-
|
|
135
|
-
return {
|
|
136
|
-
from: isProduction ? result.from : "@/plugins/tdesign-vue-next-for-dev",
|
|
137
|
-
name: result.name
|
|
138
|
-
};
|
|
139
|
-
}
|
|
122
|
+
return result;
|
|
140
123
|
},
|
|
141
124
|
type: "component"
|
|
142
125
|
},
|
|
@@ -144,7 +127,8 @@ const tDesignAutoImportResolve = (options) => {
|
|
|
144
127
|
resolve: (name) => {
|
|
145
128
|
if (name === "Loading") {
|
|
146
129
|
return {
|
|
147
|
-
from: isProduction ?
|
|
130
|
+
// from: isProduction ? 'tdesign-vue-next' : '@/plugins/tdesign-vue-next-for-dev',
|
|
131
|
+
from: "tdesign-vue-next",
|
|
148
132
|
name: "LoadingDirective"
|
|
149
133
|
};
|
|
150
134
|
}
|
|
@@ -170,13 +154,13 @@ const virtualAppParams = (options) => {
|
|
|
170
154
|
if (id !== RESOLVED_ID) {
|
|
171
155
|
return;
|
|
172
156
|
}
|
|
173
|
-
const userId = `/${relative(options.root, userFile)
|
|
157
|
+
const userId = `/${normalizePath(relative(options.root, userFile))}`;
|
|
174
158
|
return `
|
|
175
159
|
import user from ${JSON.stringify(userId)}
|
|
176
160
|
|
|
177
161
|
export default {
|
|
178
162
|
...user,
|
|
179
|
-
|
|
163
|
+
viewsEntryLazyImport: import.meta.glob(${JSON.stringify(viewsGlob)}),
|
|
180
164
|
}
|
|
181
165
|
`;
|
|
182
166
|
},
|
|
@@ -457,12 +441,11 @@ const index = (_env, options) => {
|
|
|
457
441
|
root: options.root
|
|
458
442
|
}),
|
|
459
443
|
createHtmlPlugin({
|
|
460
|
-
entry:
|
|
444
|
+
entry: "/src/main.ts",
|
|
461
445
|
// 必须绝对路径,否则类似system/log/operlog 二级页面打不开
|
|
462
446
|
inject: {
|
|
463
447
|
data: {
|
|
464
448
|
appId: VITE_APP_ID,
|
|
465
|
-
mode: isProduction ? "prod" : "dev",
|
|
466
449
|
title: VITE_APP_NAME
|
|
467
450
|
},
|
|
468
451
|
ejsOptions: {
|
|
@@ -485,7 +468,7 @@ const index = (_env, options) => {
|
|
|
485
468
|
// return imports;
|
|
486
469
|
// }
|
|
487
470
|
// defaultExportByFilename: false, // 默认为 false
|
|
488
|
-
dirs: ["src/
|
|
471
|
+
dirs: ["src/bus/autoImport"],
|
|
489
472
|
dirsScanOptions: {
|
|
490
473
|
types: false
|
|
491
474
|
// Enable auto import the types under the directories
|
|
@@ -523,7 +506,6 @@ const index = (_env, options) => {
|
|
|
523
506
|
resolvers: [
|
|
524
507
|
...options.autoImportResolvers ?? [],
|
|
525
508
|
...tDesignAutoImportResolve({
|
|
526
|
-
isProduction,
|
|
527
509
|
root: options.root
|
|
528
510
|
})
|
|
529
511
|
],
|
|
@@ -537,7 +519,6 @@ const index = (_env, options) => {
|
|
|
537
519
|
resolvers: [
|
|
538
520
|
...options.autoImportResolvers ?? [],
|
|
539
521
|
...tDesignAutoImportResolve({
|
|
540
|
-
isProduction,
|
|
541
522
|
root: options.root
|
|
542
523
|
})
|
|
543
524
|
]
|
|
@@ -556,15 +537,17 @@ const index = (_env, options) => {
|
|
|
556
537
|
find: "img",
|
|
557
538
|
// 路径以 img 开头
|
|
558
539
|
replacement: resolvePath("src/assets/images")
|
|
559
|
-
}
|
|
560
|
-
...isProduction
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
540
|
+
}
|
|
541
|
+
// ...(isProduction
|
|
542
|
+
// ? []
|
|
543
|
+
// : [
|
|
544
|
+
// {
|
|
545
|
+
// // find 为正则时只替换匹配段,必须用 ^...$ 匹配完整 id
|
|
546
|
+
// // 同时覆盖裸导入与已 resolve 的绝对路径
|
|
547
|
+
// find: /^.*tdesign-vue-next[/\\]es[/\\].*\.css$/,
|
|
548
|
+
// replacement: resolvePath('src/plugins/tdesign-vue-next-for-dev/empty.css'),
|
|
549
|
+
// },
|
|
550
|
+
// ]),
|
|
568
551
|
],
|
|
569
552
|
// https://cn.vitejs.dev/guide/performance.html#reduce-resolve-operations
|
|
570
553
|
// 不建议忽略自定义导入类型的扩展名(例如:.vue),因为它会影响 IDE 和类型支持。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dlzn-ui/vite-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "
|
|
4
|
+
"version": "2.0.1",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
7
7
|
"access": "public"
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"vite-plugin-imagemin": "^0.6.1",
|
|
38
38
|
"vite-plugin-vue-tailwind-auto-reference": "^2.0.2",
|
|
39
39
|
"vue-router": "^5.2.0",
|
|
40
|
-
"@dlzn-ui/node-utils": "
|
|
40
|
+
"@dlzn-ui/node-utils": "2.0.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"rimraf": "^6.1.3",
|