@wot-ui/vitepress-theme 2.0.0-alpha.13 → 2.0.0-alpha.15
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/config.js +21 -1
- package/package.json +1 -1
package/dist/config.js
CHANGED
|
@@ -62,8 +62,17 @@ function createInternalAliases() {
|
|
|
62
62
|
}
|
|
63
63
|
];
|
|
64
64
|
}
|
|
65
|
+
function mergeStringList(existing, defaults) {
|
|
66
|
+
const merged = new Set(defaults);
|
|
67
|
+
existing?.forEach((item) => {
|
|
68
|
+
if (typeof item === "string") {
|
|
69
|
+
merged.add(item);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return Array.from(merged);
|
|
73
|
+
}
|
|
65
74
|
function mergeNoExternal(existing) {
|
|
66
|
-
const merged = /* @__PURE__ */ new Set(["element-plus"]);
|
|
75
|
+
const merged = /* @__PURE__ */ new Set(["element-plus", "dayjs"]);
|
|
67
76
|
const noExternal = existing?.noExternal;
|
|
68
77
|
if (Array.isArray(noExternal)) {
|
|
69
78
|
noExternal.forEach((item) => {
|
|
@@ -77,6 +86,15 @@ function mergeNoExternal(existing) {
|
|
|
77
86
|
noExternal: Array.from(merged)
|
|
78
87
|
};
|
|
79
88
|
}
|
|
89
|
+
function mergeOptimizeDeps(existing) {
|
|
90
|
+
return {
|
|
91
|
+
...existing,
|
|
92
|
+
include: mergeStringList(existing?.include, ["element-plus", "dayjs", "@element-plus/icons-vue"])
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
function mergeDedupe(existing) {
|
|
96
|
+
return mergeStringList(existing, ["vue", "vitepress", "element-plus", "dayjs"]);
|
|
97
|
+
}
|
|
80
98
|
function createWotVitePressConfig(options) {
|
|
81
99
|
const userVite = options.vite ?? {};
|
|
82
100
|
const internalPlugins = [
|
|
@@ -105,9 +123,11 @@ function createWotVitePressConfig(options) {
|
|
|
105
123
|
vite: {
|
|
106
124
|
...userVite,
|
|
107
125
|
plugins: [...internalPlugins, ...normalizePlugins(userVite.plugins)],
|
|
126
|
+
optimizeDeps: mergeOptimizeDeps(userVite.optimizeDeps),
|
|
108
127
|
ssr: mergeNoExternal(userVite.ssr),
|
|
109
128
|
resolve: {
|
|
110
129
|
...userVite.resolve,
|
|
130
|
+
dedupe: mergeDedupe(userVite.resolve?.dedupe),
|
|
111
131
|
alias: [...createInternalAliases(), ...normalizeAlias(userVite.resolve?.alias)]
|
|
112
132
|
}
|
|
113
133
|
}
|