befly-vite 1.4.13 → 1.4.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/README.md +2 -3
- package/index.js +123 -128
- package/package.json +5 -7
- package/plugins/analyzer.js +0 -19
- package/plugins/auto-import.js +0 -26
- package/plugins/components.js +0 -26
- package/plugins/devtools.js +0 -14
- package/plugins/icons.js +0 -13
- package/plugins/reactivity-transform.js +0 -14
- package/plugins/router.js +0 -16
- package/plugins/vue.js +0 -13
package/README.md
CHANGED
|
@@ -26,6 +26,8 @@ import { createBeflyViteConfig } from "befly-vite";
|
|
|
26
26
|
export default createBeflyViteConfig();
|
|
27
27
|
```
|
|
28
28
|
|
|
29
|
+
> 提示:befly-admin-ui 的 `views` 路由会自动排除 `**/components/**`。
|
|
30
|
+
|
|
29
31
|
### 自定义配置
|
|
30
32
|
|
|
31
33
|
```javascript
|
|
@@ -35,9 +37,6 @@ import { fileURLToPath } from "node:url";
|
|
|
35
37
|
export default createBeflyViteConfig({
|
|
36
38
|
root: fileURLToPath(new URL(".", import.meta.url)),
|
|
37
39
|
|
|
38
|
-
// 说明:项目 views 固定扫描 "src/views";如需扫描 addon 内的视图目录,可配置 addonView(单级目录名)
|
|
39
|
-
// addonView: "adminViews",
|
|
40
|
-
|
|
41
40
|
// 自定义配置
|
|
42
41
|
viteConfig: {
|
|
43
42
|
server: {
|
package/index.js
CHANGED
|
@@ -1,105 +1,140 @@
|
|
|
1
|
-
import { existsSync,
|
|
1
|
+
import { existsSync, realpathSync } from "node:fs";
|
|
2
2
|
import { join } from "node:path";
|
|
3
3
|
import { fileURLToPath } from "node:url";
|
|
4
4
|
|
|
5
|
+
import vue from "@vitejs/plugin-vue";
|
|
6
|
+
import AutoImport from "unplugin-auto-import/vite";
|
|
7
|
+
import { TDesignResolver } from "unplugin-vue-components/resolvers";
|
|
8
|
+
import Components from "unplugin-vue-components/vite";
|
|
5
9
|
import { defineConfig, mergeConfig } from "vite";
|
|
6
|
-
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
import { createDevToolsPlugin } from "./plugins/devtools.js";
|
|
11
|
-
import { createIconsPlugin } from "./plugins/icons.js";
|
|
12
|
-
import { createRouterPlugin } from "./plugins/router.js";
|
|
13
|
-
import { createVuePlugin } from "./plugins/vue.js";
|
|
10
|
+
import { analyzer } from "vite-bundle-analyzer";
|
|
11
|
+
import VueDevTools from "vite-plugin-vue-devtools";
|
|
12
|
+
import { VueRouterAutoImports } from "vue-router/unplugin";
|
|
13
|
+
import VueRouter from "vue-router/vite";
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
|
-
*
|
|
16
|
+
* 创建路由插件配置
|
|
17
17
|
*/
|
|
18
|
-
function
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
18
|
+
function createRouterPlugin(options = {}) {
|
|
19
|
+
const { routesFolders } = options;
|
|
20
|
+
|
|
21
|
+
return VueRouter({
|
|
22
|
+
routesFolder: routesFolders,
|
|
23
|
+
dts: false,
|
|
24
|
+
extensions: [".vue"],
|
|
25
|
+
importMode: "async",
|
|
26
|
+
exclude: ["**/components/**"]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
26
29
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* 创建 Vue 插件配置
|
|
32
|
+
*/
|
|
33
|
+
function createVuePlugin() {
|
|
34
|
+
return vue({
|
|
35
|
+
script: {
|
|
36
|
+
defineModel: true,
|
|
37
|
+
propsDestructure: true
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
}
|
|
31
41
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
42
|
+
/**
|
|
43
|
+
* 创建自动导入插件配置
|
|
44
|
+
*/
|
|
45
|
+
function createAutoImportPlugin() {
|
|
46
|
+
return AutoImport({
|
|
47
|
+
// 只给 admin 自身源码做自动导入;addon 视图强制手动导入
|
|
48
|
+
include: [/[\\/]src[\\/].*\.(vue|js)$/],
|
|
49
|
+
exclude: [/[\\/]packages[\\/].*[\\/]views[\\/]/, /[\\/]node_modules[\\/]befly-admin-ui[\\/]views[\\/]/],
|
|
50
|
+
imports: ["vue", "pinia", VueRouterAutoImports],
|
|
51
|
+
resolvers: [
|
|
52
|
+
TDesignResolver({
|
|
53
|
+
library: "vue-next"
|
|
54
|
+
})
|
|
55
|
+
],
|
|
56
|
+
dts: false,
|
|
57
|
+
dirs: ["src/utils", "src/plugins", "src/config"],
|
|
58
|
+
vueTemplate: true
|
|
59
|
+
});
|
|
60
|
+
}
|
|
36
61
|
|
|
37
|
-
|
|
38
|
-
if (
|
|
39
|
-
return
|
|
62
|
+
function resolveTDesignIcon(componentName) {
|
|
63
|
+
if (componentName === "Icon" || componentName === "IconFont" || componentName.endsWith("Icon")) {
|
|
64
|
+
return {
|
|
65
|
+
name: componentName,
|
|
66
|
+
from: "tdesign-icons-vue-next"
|
|
67
|
+
};
|
|
40
68
|
}
|
|
69
|
+
}
|
|
41
70
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
71
|
+
/**
|
|
72
|
+
* 创建组件自动导入插件配置
|
|
73
|
+
*/
|
|
74
|
+
function createComponentsPlugin() {
|
|
75
|
+
return Components({
|
|
76
|
+
// 只给 admin 自身源码做组件自动注册;addon 视图强制手动导入
|
|
77
|
+
include: [/[\\/]src[\\/].*\.vue$/],
|
|
78
|
+
exclude: [/[\\/]packages[\\/].*[\\/]views[\\/]/, /[\\/]node_modules[\\/]befly-admin-ui[\\/]views[\\/]/],
|
|
79
|
+
resolvers: [
|
|
80
|
+
TDesignResolver({
|
|
81
|
+
library: "vue-next"
|
|
82
|
+
}),
|
|
83
|
+
resolveTDesignIcon
|
|
84
|
+
],
|
|
85
|
+
dirs: ["src/components"],
|
|
86
|
+
deep: true,
|
|
87
|
+
dts: false
|
|
88
|
+
});
|
|
89
|
+
}
|
|
49
90
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
91
|
+
/**
|
|
92
|
+
* 创建打包分析插件配置
|
|
93
|
+
*/
|
|
94
|
+
function createAnalyzerPlugin(options = {}) {
|
|
95
|
+
const { analyzerMode = "static", fileName = "bundle-report", reportTitle = "打包分析", openAnalyzer = false } = options;
|
|
96
|
+
|
|
97
|
+
return analyzer({
|
|
98
|
+
analyzerMode: analyzerMode,
|
|
99
|
+
fileName: fileName,
|
|
100
|
+
reportTitle: reportTitle,
|
|
101
|
+
defaultSizes: "gzip",
|
|
102
|
+
gzipOptions: {},
|
|
103
|
+
brotliOptions: {},
|
|
104
|
+
openAnalyzer: openAnalyzer,
|
|
105
|
+
summary: true
|
|
106
|
+
});
|
|
107
|
+
}
|
|
57
108
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
109
|
+
/**
|
|
110
|
+
* 创建 Vue DevTools 插件配置(仅开发环境)
|
|
111
|
+
*/
|
|
112
|
+
function createDevToolsPlugin() {
|
|
113
|
+
// 该插件内部会引入 inspector 能力;如果在非开发环境启用,容易引入不必要的解析开销/兼容性风险。
|
|
114
|
+
// Vite 的 plugins 数组允许包含 null/false,会被自动忽略。
|
|
115
|
+
if (process.env.NODE_ENV === "production") {
|
|
116
|
+
return null;
|
|
61
117
|
}
|
|
62
118
|
|
|
63
|
-
|
|
64
|
-
// - addon 路由(importMode: async)应按页面懒加载自然拆分。
|
|
65
|
-
// - node_modules 让 Rollup 按共享与动态导入边界自动拆分即可。
|
|
66
|
-
// 如需进一步细分,可通过 createBeflyViteConfig({ manualChunks }) 注入自定义策略。
|
|
119
|
+
return VueDevTools();
|
|
67
120
|
}
|
|
68
121
|
|
|
69
122
|
/**
|
|
70
123
|
* 创建 Befly Vite 配置
|
|
71
124
|
* @param {Object} options - 配置选项
|
|
72
125
|
* @param {string} options.root - 项目根目录(可选)
|
|
73
|
-
* @param {string} options.addonView - addon 内要扫描的视图目录名(可选,默认 "adminViews")
|
|
74
126
|
* @param {Object} options.resolvers - 自定义 resolvers(可选)
|
|
75
127
|
* @param {Function} options.manualChunks - 自定义分包配置(可选)
|
|
76
128
|
* @param {Object} options.viteConfig - 用户自定义配置(可选)
|
|
77
129
|
* @returns {Object} Vite 配置对象
|
|
78
130
|
*/
|
|
79
131
|
export function createBeflyViteConfig(options = {}) {
|
|
80
|
-
const { root,
|
|
132
|
+
const { root, resolvers = {}, manualChunks, viteConfig = {} } = options;
|
|
81
133
|
|
|
82
134
|
// 计算根目录(如果未提供)
|
|
83
135
|
const appRoot = root || process.cwd();
|
|
84
136
|
|
|
85
|
-
|
|
86
|
-
throw new Error('createBeflyViteConfig({ addonView }) 中 addonView 必须是字符串目录名。\n例如:addonView: "adminViews"');
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
if (addonView.trim() !== addonView) {
|
|
90
|
-
throw new Error('createBeflyViteConfig({ addonView }) 中 addonView 不能包含首尾空格。\n例如:addonView: "adminViews"');
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
if (!addonView) {
|
|
94
|
-
throw new Error('createBeflyViteConfig({ addonView }) 中 addonView 不能为空。\n例如:addonView: "adminViews"');
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
// 只能是单级目录名:禁止多级路径与路径穿越
|
|
98
|
-
if (addonView === "." || addonView === ".." || addonView.includes("/") || addonView.includes("\\") || addonView.includes("..") || addonView.includes("\0")) {
|
|
99
|
-
throw new Error('createBeflyViteConfig({ addonView }) 中 addonView 必须是单级目录名(不能是多级路径)。\n例如:addonView: "adminViews"');
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const routesFolders = scanViewsInternal(appRoot, addonView);
|
|
137
|
+
const routesFolders = scanViews(appRoot);
|
|
103
138
|
|
|
104
139
|
const enableAnalyzer = process.env["ANALYZE"] === "1";
|
|
105
140
|
|
|
@@ -107,13 +142,12 @@ export function createBeflyViteConfig(options = {}) {
|
|
|
107
142
|
const plugins = [];
|
|
108
143
|
plugins.push(createRouterPlugin({ routesFolders: routesFolders }));
|
|
109
144
|
plugins.push(createVuePlugin());
|
|
110
|
-
plugins.push(createDevToolsPlugin());
|
|
145
|
+
// plugins.push(createDevToolsPlugin());
|
|
111
146
|
plugins.push(createAutoImportPlugin({ resolvers: resolvers }));
|
|
112
147
|
plugins.push(createComponentsPlugin({ resolvers: resolvers }));
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
148
|
+
// if (enableAnalyzer) {
|
|
149
|
+
// plugins.push(createAnalyzerPlugin());
|
|
150
|
+
// }
|
|
117
151
|
|
|
118
152
|
const baseConfig = defineConfig({
|
|
119
153
|
base: "./",
|
|
@@ -132,35 +166,12 @@ export function createBeflyViteConfig(options = {}) {
|
|
|
132
166
|
},
|
|
133
167
|
|
|
134
168
|
build: {
|
|
135
|
-
target: "es2020",
|
|
136
169
|
outDir: "dist",
|
|
137
|
-
assetsDir: "assets"
|
|
138
|
-
sourcemap: false,
|
|
139
|
-
reportCompressedSize: false,
|
|
140
|
-
chunkSizeWarningLimit: 1000,
|
|
141
|
-
commonjsOptions: {
|
|
142
|
-
include: [/node_modules/],
|
|
143
|
-
transformMixedEsModules: true
|
|
144
|
-
},
|
|
145
|
-
rolldownOptions: {
|
|
146
|
-
output: {
|
|
147
|
-
chunkFileNames: "assets/js/[name]-[hash].js",
|
|
148
|
-
entryFileNames: "assets/js/[name]-[hash].js",
|
|
149
|
-
assetFileNames: "assets/[ext]/[name]-[hash].[ext]",
|
|
150
|
-
codeSplitting: true,
|
|
151
|
-
manualChunks(id) {
|
|
152
|
-
if (typeof manualChunks === "function") {
|
|
153
|
-
const chunkName = manualChunks(id);
|
|
154
|
-
if (chunkName) return chunkName;
|
|
155
|
-
}
|
|
156
|
-
return defaultManualChunks(id);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
170
|
+
assetsDir: "assets"
|
|
160
171
|
},
|
|
161
172
|
|
|
162
173
|
optimizeDeps: {
|
|
163
|
-
include: ["vue", "vue-router", "pinia", "axios", "tdesign-vue-next"]
|
|
174
|
+
include: ["vue", "vue-router", "pinia", "axios", "tdesign-vue-next", "tdesign-icons-vue-next"]
|
|
164
175
|
}
|
|
165
176
|
});
|
|
166
177
|
|
|
@@ -168,13 +179,12 @@ export function createBeflyViteConfig(options = {}) {
|
|
|
168
179
|
}
|
|
169
180
|
|
|
170
181
|
/**
|
|
171
|
-
*
|
|
182
|
+
* 扫描项目和 befly-admin-ui 的视图目录
|
|
172
183
|
* @param {string} appRoot
|
|
173
|
-
* @param {string} addonView
|
|
174
184
|
* @returns {Array<{ src: string, path: string, exclude: string[] }>}
|
|
175
185
|
*/
|
|
176
|
-
function
|
|
177
|
-
const
|
|
186
|
+
export function scanViews(appRoot = process.cwd()) {
|
|
187
|
+
const adminUiPath = join(appRoot, "node_modules", "befly-admin-ui");
|
|
178
188
|
|
|
179
189
|
/** @type {Array<{ src: string, path: string, exclude: string[] }>} */
|
|
180
190
|
const routesFolders = [];
|
|
@@ -189,31 +199,16 @@ function scanViewsInternal(appRoot, addonView = "adminViews") {
|
|
|
189
199
|
});
|
|
190
200
|
}
|
|
191
201
|
|
|
192
|
-
// 2. 扫描
|
|
193
|
-
if (
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const addonPath = join(addonBasePath, addonName);
|
|
202
|
-
if (!existsSync(addonPath)) {
|
|
203
|
-
continue;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
const addonViewPath = join(addonPath, addonView);
|
|
207
|
-
if (existsSync(addonViewPath)) {
|
|
208
|
-
routesFolders.push({
|
|
209
|
-
src: realpathSync(addonViewPath),
|
|
210
|
-
path: `addon/${addonName}/`,
|
|
211
|
-
exclude: ["**/components/**"]
|
|
212
|
-
});
|
|
213
|
-
}
|
|
202
|
+
// 2. 扫描 befly-admin-ui/views(框架内置视图)
|
|
203
|
+
if (existsSync(adminUiPath)) {
|
|
204
|
+
const adminUiViewsPath = join(adminUiPath, "views");
|
|
205
|
+
if (existsSync(adminUiViewsPath)) {
|
|
206
|
+
routesFolders.push({
|
|
207
|
+
src: realpathSync(adminUiViewsPath),
|
|
208
|
+
path: "core/",
|
|
209
|
+
exclude: ["**/components/**"]
|
|
210
|
+
});
|
|
214
211
|
}
|
|
215
|
-
} catch {
|
|
216
|
-
// 扫描失败保持静默,避免影响 Vite 启动
|
|
217
212
|
}
|
|
218
213
|
|
|
219
214
|
return routesFolders;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "befly-vite",
|
|
3
|
-
"version": "1.4.
|
|
4
|
-
"gitHead": "
|
|
3
|
+
"version": "1.4.15",
|
|
4
|
+
"gitHead": "3f389979b8d565fe0476e0859df5a2c94627137c",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Befly Vite 配置预设和插件集合",
|
|
7
7
|
"keywords": [
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
"index.browser.js",
|
|
19
19
|
"index.js",
|
|
20
20
|
"package.json",
|
|
21
|
-
"README.md"
|
|
22
|
-
"plugins/"
|
|
21
|
+
"README.md"
|
|
23
22
|
],
|
|
24
23
|
"type": "module",
|
|
25
24
|
"exports": {
|
|
@@ -37,14 +36,13 @@
|
|
|
37
36
|
"@vitejs/plugin-vue": "^6.0.4",
|
|
38
37
|
"sass": "^1.97.3",
|
|
39
38
|
"unplugin-auto-import": "^21.0.0",
|
|
40
|
-
"unplugin-icons": "^23.0.1",
|
|
41
39
|
"unplugin-vue-components": "^31.0.0",
|
|
42
40
|
"vite-bundle-analyzer": "^1.3.6",
|
|
43
41
|
"vite-plugin-vue-devtools": "^8.0.6"
|
|
44
42
|
},
|
|
45
43
|
"peerDependencies": {
|
|
46
|
-
"vite": "^8.0.0-beta.
|
|
47
|
-
"vue": "^3.5.
|
|
44
|
+
"vite": "^8.0.0-beta.15",
|
|
45
|
+
"vue": "^3.5.28",
|
|
48
46
|
"vue-router": "^5.0.2"
|
|
49
47
|
},
|
|
50
48
|
"engines": {
|
package/plugins/analyzer.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { analyzer } from "vite-bundle-analyzer";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 创建打包分析插件配置
|
|
5
|
-
*/
|
|
6
|
-
export function createAnalyzerPlugin(options = {}) {
|
|
7
|
-
const { analyzerMode = "static", fileName = "bundle-report", reportTitle = "打包分析", openAnalyzer = false } = options;
|
|
8
|
-
|
|
9
|
-
return analyzer({
|
|
10
|
-
analyzerMode: analyzerMode,
|
|
11
|
-
fileName: fileName,
|
|
12
|
-
reportTitle: reportTitle,
|
|
13
|
-
defaultSizes: "gzip",
|
|
14
|
-
gzipOptions: {},
|
|
15
|
-
brotliOptions: {},
|
|
16
|
-
openAnalyzer: openAnalyzer,
|
|
17
|
-
summary: true
|
|
18
|
-
});
|
|
19
|
-
}
|
package/plugins/auto-import.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import AutoImport from "unplugin-auto-import/vite";
|
|
2
|
-
import { TDesignResolver } from "unplugin-vue-components/resolvers";
|
|
3
|
-
import { VueRouterAutoImports } from "vue-router/unplugin";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 创建自动导入插件配置
|
|
7
|
-
*/
|
|
8
|
-
export function createAutoImportPlugin(options = {}) {
|
|
9
|
-
const { resolvers = {} } = options;
|
|
10
|
-
|
|
11
|
-
return AutoImport({
|
|
12
|
-
// 只给 admin 自身源码做自动导入;addon 视图强制手动导入
|
|
13
|
-
include: [/[\\/]src[\\/].*\.(vue|ts|tsx)$/],
|
|
14
|
-
exclude: [/[\\/]packages[\\/].*[\\/](adminViews|appViews)[\\/]/, /[\\/]node_modules[\\/]@befly-addon[\\/].*[\\/](adminViews|appViews)[\\/]/],
|
|
15
|
-
imports: ["vue", "pinia", VueRouterAutoImports],
|
|
16
|
-
resolvers: [
|
|
17
|
-
TDesignResolver({
|
|
18
|
-
library: "vue-next"
|
|
19
|
-
}),
|
|
20
|
-
...(resolvers.auto || [])
|
|
21
|
-
],
|
|
22
|
-
dts: "src/types/auto-imports.d.ts",
|
|
23
|
-
dirs: ["src/utils", "src/plugins", "src/config"],
|
|
24
|
-
vueTemplate: true
|
|
25
|
-
});
|
|
26
|
-
}
|
package/plugins/components.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import IconsResolver from "unplugin-icons/resolver";
|
|
2
|
-
import { TDesignResolver } from "unplugin-vue-components/resolvers";
|
|
3
|
-
import Components from "unplugin-vue-components/vite";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 创建组件自动导入插件配置
|
|
7
|
-
*/
|
|
8
|
-
export function createComponentsPlugin(options = {}) {
|
|
9
|
-
const { resolvers = {} } = options;
|
|
10
|
-
|
|
11
|
-
return Components({
|
|
12
|
-
// 只给 admin 自身源码做组件自动注册;addon 视图强制手动导入
|
|
13
|
-
include: [/[\\/]src[\\/].*\.vue$/],
|
|
14
|
-
exclude: [/[\\/]packages[\\/].*[\\/](adminViews|appViews)[\\/]/, /[\\/]node_modules[\\/]@befly-addon[\\/].*[\\/](adminViews|appViews)[\\/]/],
|
|
15
|
-
resolvers: [
|
|
16
|
-
TDesignResolver({
|
|
17
|
-
library: "vue-next"
|
|
18
|
-
}),
|
|
19
|
-
IconsResolver({}),
|
|
20
|
-
...(resolvers.components || [])
|
|
21
|
-
],
|
|
22
|
-
dirs: ["src/components"],
|
|
23
|
-
deep: true,
|
|
24
|
-
dts: "src/types/components.d.ts"
|
|
25
|
-
});
|
|
26
|
-
}
|
package/plugins/devtools.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import VueDevTools from "vite-plugin-vue-devtools";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 创建 Vue DevTools 插件配置(仅开发环境)
|
|
5
|
-
*/
|
|
6
|
-
export function createDevToolsPlugin() {
|
|
7
|
-
// 该插件内部会引入 inspector 能力;如果在非开发环境启用,容易引入不必要的解析开销/兼容性风险。
|
|
8
|
-
// Vite 的 plugins 数组允许包含 null/false,会被自动忽略。
|
|
9
|
-
if (process.env.NODE_ENV === "production") {
|
|
10
|
-
return null;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
return VueDevTools();
|
|
14
|
-
}
|
package/plugins/icons.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ⚠️ 说明
|
|
3
|
-
*
|
|
4
|
-
* 本仓库已不再依赖 @vue-macros/reactivity-transform。
|
|
5
|
-
*
|
|
6
|
-
* 这个文件保留为“空实现”,避免旧项目/旧代码在仍引用 createReactivityTransformPlugin 时直接崩溃。
|
|
7
|
-
* 新项目请使用 Vue 原生 ref/reactive/computed 等 API,不要使用 $ref/$computed/$shallowRef 宏。
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
export function createReactivityTransformPlugin() {
|
|
11
|
-
return {
|
|
12
|
-
name: "befly-no-reactivity-transform"
|
|
13
|
-
};
|
|
14
|
-
}
|
package/plugins/router.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import VueRouter from "vue-router/vite";
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 创建路由插件配置
|
|
5
|
-
*/
|
|
6
|
-
export function createRouterPlugin(options = {}) {
|
|
7
|
-
const { routesFolders } = options;
|
|
8
|
-
|
|
9
|
-
return VueRouter({
|
|
10
|
-
routesFolder: routesFolders,
|
|
11
|
-
dts: "./src/types/typed-router.d.ts",
|
|
12
|
-
extensions: [".vue"],
|
|
13
|
-
importMode: "async",
|
|
14
|
-
exclude: ["**/components/**"]
|
|
15
|
-
});
|
|
16
|
-
}
|