@allkit/vite-config 0.0.2 → 0.0.4
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/skills/SKILL.md +31 -0
- package/dist/skills/examples/vite.config.ts +32 -0
- package/dist/skills/references/viteConfig.md +58 -0
- package/dist/skills/vite-config/SKILL.md +31 -0
- package/dist/skills/vite-config/examples/vite.config.ts +32 -0
- package/dist/skills/vite-config/references/viteConfig.md +58 -0
- package/package.json +1 -1
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-config
|
|
3
|
+
description: 标准化的 Vite 配置,提供一致的开发服务器和构建环境 / Standardized Vite configuration
|
|
4
|
+
author: allkit
|
|
5
|
+
category: tooling
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# @allkit/vite-config
|
|
9
|
+
|
|
10
|
+
Vite 配置文件,提供一致的开发服务器和构建环境。
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add -D vite @allkit/vite-config
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Functions
|
|
19
|
+
|
|
20
|
+
| Function | Description |
|
|
21
|
+
|----------|-------------|
|
|
22
|
+
| [viteConfig](./references/viteConfig.md) | 主配置函数 |
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { defineConfig } from 'vite'
|
|
28
|
+
import { viteConfig } from '@allkit/vite-config'
|
|
29
|
+
|
|
30
|
+
export default defineConfig(viteConfig())
|
|
31
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { viteConfig } from '@allkit/vite-config'
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
5
|
+
import { resolve } from 'path'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
...viteConfig({
|
|
9
|
+
plugins: [vue(), vueJsx()]
|
|
10
|
+
}),
|
|
11
|
+
server: {
|
|
12
|
+
port: 3000,
|
|
13
|
+
host: '0.0.0.0',
|
|
14
|
+
open: true,
|
|
15
|
+
proxy: {
|
|
16
|
+
'/api': {
|
|
17
|
+
target: 'http://localhost:8080',
|
|
18
|
+
changeOrigin: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
build: {
|
|
23
|
+
outDir: 'dist',
|
|
24
|
+
sourcemap: process.env.NODE_ENV === 'development',
|
|
25
|
+
minify: 'esbuild'
|
|
26
|
+
},
|
|
27
|
+
resolve: {
|
|
28
|
+
alias: {
|
|
29
|
+
'@': resolve(__dirname, 'src')
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# viteConfig
|
|
2
|
+
|
|
3
|
+
Vite 主配置函数
|
|
4
|
+
|
|
5
|
+
## Signature
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
function viteConfig(options?: ViteConfigOptions): ViteUserConfig
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
| Option | Type | Default | Description |
|
|
14
|
+
|--------|------|---------|-------------|
|
|
15
|
+
| `plugins` | `Plugin[]` | `[]` | 插件列表 |
|
|
16
|
+
| `server` | `ServerOptions` | - | 开发服务器配置 |
|
|
17
|
+
| `build` | `BuildOptions` | - | 构建配置 |
|
|
18
|
+
| `resolve` | `ResolveOptions` | - | 模块解析配置 |
|
|
19
|
+
|
|
20
|
+
## Server Options
|
|
21
|
+
|
|
22
|
+
| Option | Type | Default | Description |
|
|
23
|
+
|--------|------|---------|-------------|
|
|
24
|
+
| `port` | `number` | `3000` | 服务端口 |
|
|
25
|
+
| `host` | `string` | `localhost` | 服务地址 |
|
|
26
|
+
| `proxy` | `object` | `{}` | 代理配置 |
|
|
27
|
+
| `open` | `boolean` | `false` | 自动打开浏览器 |
|
|
28
|
+
|
|
29
|
+
## Build Options
|
|
30
|
+
|
|
31
|
+
| Option | Type | Default | Description |
|
|
32
|
+
|--------|------|---------|-------------|
|
|
33
|
+
| `outDir` | `string` | `dist` | 输出目录 |
|
|
34
|
+
| `sourcemap` | `boolean` | `false` | 生成 sourcemap |
|
|
35
|
+
| `minify` | `string` | `esbuild` | 压缩方式 |
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { defineConfig } from 'vite'
|
|
41
|
+
import { viteConfig } from '@allkit/vite-config'
|
|
42
|
+
import vue from '@vitejs/plugin-vue'
|
|
43
|
+
|
|
44
|
+
export default defineConfig(
|
|
45
|
+
viteConfig({
|
|
46
|
+
plugins: [vue()],
|
|
47
|
+
server: {
|
|
48
|
+
port: 3000,
|
|
49
|
+
proxy: {
|
|
50
|
+
'/api': {
|
|
51
|
+
target: 'http://localhost:8080',
|
|
52
|
+
changeOrigin: true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
```
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: vite-config
|
|
3
|
+
description: 标准化的 Vite 配置,提供一致的开发服务器和构建环境 / Standardized Vite configuration
|
|
4
|
+
author: allkit
|
|
5
|
+
category: tooling
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# @allkit/vite-config
|
|
9
|
+
|
|
10
|
+
Vite 配置文件,提供一致的开发服务器和构建环境。
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
pnpm add -D vite @allkit/vite-config
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## Functions
|
|
19
|
+
|
|
20
|
+
| Function | Description |
|
|
21
|
+
|----------|-------------|
|
|
22
|
+
| [viteConfig](./references/viteConfig.md) | 主配置函数 |
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
```ts
|
|
27
|
+
import { defineConfig } from 'vite'
|
|
28
|
+
import { viteConfig } from '@allkit/vite-config'
|
|
29
|
+
|
|
30
|
+
export default defineConfig(viteConfig())
|
|
31
|
+
```
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { defineConfig } from 'vite'
|
|
2
|
+
import { viteConfig } from '@allkit/vite-config'
|
|
3
|
+
import vue from '@vitejs/plugin-vue'
|
|
4
|
+
import vueJsx from '@vitejs/plugin-vue-jsx'
|
|
5
|
+
import { resolve } from 'path'
|
|
6
|
+
|
|
7
|
+
export default defineConfig({
|
|
8
|
+
...viteConfig({
|
|
9
|
+
plugins: [vue(), vueJsx()]
|
|
10
|
+
}),
|
|
11
|
+
server: {
|
|
12
|
+
port: 3000,
|
|
13
|
+
host: '0.0.0.0',
|
|
14
|
+
open: true,
|
|
15
|
+
proxy: {
|
|
16
|
+
'/api': {
|
|
17
|
+
target: 'http://localhost:8080',
|
|
18
|
+
changeOrigin: true
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
build: {
|
|
23
|
+
outDir: 'dist',
|
|
24
|
+
sourcemap: process.env.NODE_ENV === 'development',
|
|
25
|
+
minify: 'esbuild'
|
|
26
|
+
},
|
|
27
|
+
resolve: {
|
|
28
|
+
alias: {
|
|
29
|
+
'@': resolve(__dirname, 'src')
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
})
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# viteConfig
|
|
2
|
+
|
|
3
|
+
Vite 主配置函数
|
|
4
|
+
|
|
5
|
+
## Signature
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
function viteConfig(options?: ViteConfigOptions): ViteUserConfig
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Options
|
|
12
|
+
|
|
13
|
+
| Option | Type | Default | Description |
|
|
14
|
+
|--------|------|---------|-------------|
|
|
15
|
+
| `plugins` | `Plugin[]` | `[]` | 插件列表 |
|
|
16
|
+
| `server` | `ServerOptions` | - | 开发服务器配置 |
|
|
17
|
+
| `build` | `BuildOptions` | - | 构建配置 |
|
|
18
|
+
| `resolve` | `ResolveOptions` | - | 模块解析配置 |
|
|
19
|
+
|
|
20
|
+
## Server Options
|
|
21
|
+
|
|
22
|
+
| Option | Type | Default | Description |
|
|
23
|
+
|--------|------|---------|-------------|
|
|
24
|
+
| `port` | `number` | `3000` | 服务端口 |
|
|
25
|
+
| `host` | `string` | `localhost` | 服务地址 |
|
|
26
|
+
| `proxy` | `object` | `{}` | 代理配置 |
|
|
27
|
+
| `open` | `boolean` | `false` | 自动打开浏览器 |
|
|
28
|
+
|
|
29
|
+
## Build Options
|
|
30
|
+
|
|
31
|
+
| Option | Type | Default | Description |
|
|
32
|
+
|--------|------|---------|-------------|
|
|
33
|
+
| `outDir` | `string` | `dist` | 输出目录 |
|
|
34
|
+
| `sourcemap` | `boolean` | `false` | 生成 sourcemap |
|
|
35
|
+
| `minify` | `string` | `esbuild` | 压缩方式 |
|
|
36
|
+
|
|
37
|
+
## Example
|
|
38
|
+
|
|
39
|
+
```ts
|
|
40
|
+
import { defineConfig } from 'vite'
|
|
41
|
+
import { viteConfig } from '@allkit/vite-config'
|
|
42
|
+
import vue from '@vitejs/plugin-vue'
|
|
43
|
+
|
|
44
|
+
export default defineConfig(
|
|
45
|
+
viteConfig({
|
|
46
|
+
plugins: [vue()],
|
|
47
|
+
server: {
|
|
48
|
+
port: 3000,
|
|
49
|
+
proxy: {
|
|
50
|
+
'/api': {
|
|
51
|
+
target: 'http://localhost:8080',
|
|
52
|
+
changeOrigin: true
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
})
|
|
57
|
+
)
|
|
58
|
+
```
|