@pubinfo/vite 2.2.0 → 2.2.2
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 +57 -0
- package/package.json +3 -3
package/README.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# @pubinfo/vite
|
|
2
|
+
|
|
3
|
+
Pubinfo 的 Vite 配置与插件集成层。它把应用模板、模块模板和一组 Pubinfo 约定封装成可复用的配置工厂。
|
|
4
|
+
|
|
5
|
+
## 它在做什么
|
|
6
|
+
|
|
7
|
+
- 提供 `definePubinfoConfig()`,生成应用型项目默认配置
|
|
8
|
+
- 提供 `defineModuleConfig()`,生成模块型项目默认配置
|
|
9
|
+
- 统一注入 Vue、JSX、UnoCSS、图标、自动导入、组件解析、OpenAPI、mock、压缩、system info 等插件
|
|
10
|
+
- 内置别名解析、代理生成、打包清理、声明文件生成、CSS 注入、虚拟检查器等插件
|
|
11
|
+
- 暴露 `PubinfoConfig` / `ModuleConfig` 类型
|
|
12
|
+
|
|
13
|
+
## 基本用法
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import { definePubinfoConfig } from '@pubinfo/vite';
|
|
17
|
+
|
|
18
|
+
export default definePubinfoConfig({
|
|
19
|
+
vite: {
|
|
20
|
+
server: {
|
|
21
|
+
port: 5173,
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
模块开发场景:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { defineModuleConfig } from '@pubinfo/vite';
|
|
31
|
+
|
|
32
|
+
export default defineModuleConfig({
|
|
33
|
+
moduleId: 'demo',
|
|
34
|
+
});
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## 默认能力
|
|
38
|
+
|
|
39
|
+
应用配置默认会处理:
|
|
40
|
+
|
|
41
|
+
- `@` / `#` 别名
|
|
42
|
+
- `VITE_APP_API_*` 到 `/xxx/proxy` 的代理映射
|
|
43
|
+
- 构建分包策略
|
|
44
|
+
- 开发期 devtools、虚拟 inspector、欢迎信息
|
|
45
|
+
- 生产构建压缩
|
|
46
|
+
|
|
47
|
+
模块配置额外会处理:
|
|
48
|
+
|
|
49
|
+
- `.d.ts` 生成
|
|
50
|
+
- 库模式 CSS 注入
|
|
51
|
+
- 自动注入模块元信息
|
|
52
|
+
|
|
53
|
+
## 仓库关系
|
|
54
|
+
|
|
55
|
+
- 被 `pubinfo/node` 对外重新导出。
|
|
56
|
+
- `@pubinfo/cli` 会读取用户的 `pubinfo.config.ts`,最终执行这里生成的 `vite` 配置。
|
|
57
|
+
- `@pubinfo/devtools` 作为开发插件被这里自动接入。
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pubinfo/vite",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "2.2.
|
|
4
|
+
"version": "2.2.2",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
7
7
|
"types": "./dist/index.d.mts",
|
|
@@ -54,8 +54,8 @@
|
|
|
54
54
|
"vite-plugin-fake-server": "^2.2.2",
|
|
55
55
|
"vite-plugin-lib-inject-css": "^2.2.2",
|
|
56
56
|
"vite-plugin-vue-devtools": "^8.1.1",
|
|
57
|
-
"@pubinfo/devtools": "2.2.
|
|
58
|
-
"@pubinfo/shared": "2.2.
|
|
57
|
+
"@pubinfo/devtools": "2.2.2",
|
|
58
|
+
"@pubinfo/shared": "2.2.2"
|
|
59
59
|
},
|
|
60
60
|
"devDependencies": {
|
|
61
61
|
"@types/fs-extra": "^11.0.4",
|