@dlzn-ui/vite-config 2.0.4 → 2.0.6
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 +11 -17
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import path, { basename, resolve,
|
|
1
|
+
import path, { basename, resolve, posix } from 'node:path';
|
|
2
2
|
import AutoImport from 'unplugin-auto-import/vite';
|
|
3
3
|
import Components from 'unplugin-vue-components/vite';
|
|
4
|
-
import {
|
|
4
|
+
import { 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';
|
|
@@ -15,7 +15,6 @@ import { browserslistToTargets } from 'lightningcss';
|
|
|
15
15
|
import tailwindAutoReference from 'vite-plugin-vue-tailwind-auto-reference';
|
|
16
16
|
import { TDesignResolver } from '@tdesign-vue-next/auto-import-resolver';
|
|
17
17
|
import { upperFirst as upperFirst$1, camelCase, kebabCase } from 'lodash-es';
|
|
18
|
-
import { existsSync } from 'node:fs';
|
|
19
18
|
import { webUpdateNotice } from '@plugin-web-update-notification/vite';
|
|
20
19
|
import { visualizer } from 'rollup-plugin-visualizer';
|
|
21
20
|
import { compression } from 'vite-plugin-compression2';
|
|
@@ -76,11 +75,13 @@ const optimizeDepsInclude = [
|
|
|
76
75
|
"dayjs/plugin/customParseFormat.js",
|
|
77
76
|
"dayjs/plugin/isSameOrBefore.js",
|
|
78
77
|
"wordcloud",
|
|
78
|
+
"tdesign-vue-next",
|
|
79
79
|
"@tdesign-vue-next/chat",
|
|
80
80
|
"dompurify",
|
|
81
81
|
"dlzn-ui/hooks/useContextMenu/menu",
|
|
82
82
|
"dlzn-ui/plugins/directive",
|
|
83
83
|
"dlzn-ui/plugins/initialize",
|
|
84
|
+
"dlzn-ui/constants",
|
|
84
85
|
"dlzn-ui/router",
|
|
85
86
|
"dlzn-ui/store"
|
|
86
87
|
];
|
|
@@ -138,27 +139,22 @@ const tDesignAutoImportResolve = (options) => {
|
|
|
138
139
|
|
|
139
140
|
const VIRTUAL_ID = "virtual:dlzn-ui/app-params";
|
|
140
141
|
const RESOLVED_ID = `\0${VIRTUAL_ID}`;
|
|
141
|
-
const virtualAppParams = (
|
|
142
|
-
const userFile = resolve(options.root, options.appParamsFile ?? "src/app-params.ts");
|
|
143
|
-
const viewsGlob = options.viewsGlob ?? "@/views/**/index.vue";
|
|
142
|
+
const virtualAppParams = () => {
|
|
144
143
|
return {
|
|
145
|
-
buildStart() {
|
|
146
|
-
if (!existsSync(userFile)) {
|
|
147
|
-
throw new Error(`[dlzn-ui] \u672A\u627E\u5230 ${userFile}`);
|
|
148
|
-
}
|
|
149
|
-
},
|
|
150
144
|
enforce: "pre",
|
|
151
145
|
load(id) {
|
|
152
146
|
if (id !== RESOLVED_ID) {
|
|
153
147
|
return;
|
|
154
148
|
}
|
|
155
|
-
const userId = `/${normalizePath(relative(options.root, userFile))}`;
|
|
156
149
|
return `
|
|
157
|
-
import user from
|
|
150
|
+
import user from "@/app-params.ts"
|
|
151
|
+
import layoutsEntryLazyImport from "@/layout/index.ts"
|
|
152
|
+
import viewsEntryLazyImport from "@/views/index.ts"
|
|
158
153
|
|
|
159
154
|
export default {
|
|
155
|
+
layoutsEntryLazyImport,
|
|
156
|
+
viewsEntryLazyImport,
|
|
160
157
|
...user,
|
|
161
|
-
viewsEntryLazyImport: import.meta.glob(${JSON.stringify(viewsGlob)}),
|
|
162
158
|
}
|
|
163
159
|
`;
|
|
164
160
|
},
|
|
@@ -435,9 +431,7 @@ const index = (_env, options) => {
|
|
|
435
431
|
// envParse({
|
|
436
432
|
// dtsPath: 'types/env.d.ts',
|
|
437
433
|
// }),
|
|
438
|
-
virtualAppParams(
|
|
439
|
-
root: options.root
|
|
440
|
-
}),
|
|
434
|
+
virtualAppParams(),
|
|
441
435
|
createHtmlPlugin({
|
|
442
436
|
entry: "/src/main.ts",
|
|
443
437
|
// 必须绝对路径,否则类似system/log/operlog 二级页面打不开
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dlzn-ui/vite-config",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.0.
|
|
4
|
+
"version": "2.0.6",
|
|
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": "2.0.
|
|
40
|
+
"@dlzn-ui/node-utils": "2.0.6"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"rimraf": "^6.1.3",
|