xto-fronted 0.4.100 → 0.4.102

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/vite.config.ts CHANGED
@@ -1,139 +1,139 @@
1
- import { defineConfig, loadEnv } from 'vite'
2
- import vue from '@vitejs/plugin-vue'
3
- import dts from 'vite-plugin-dts'
4
- import { resolve } from 'path'
5
-
6
- export default defineConfig(({ mode }) => {
7
- const env = loadEnv(mode, process.cwd())
8
- const isLib = mode === 'lib'
9
-
10
- return {
11
- plugins: [
12
- vue(),
13
- ...(isLib ? [dts({ insertTypesEntry: true, outDir: 'dist' })] : [])
14
- ],
15
- resolve: {
16
- alias: {
17
- '@': resolve(__dirname, 'src'),
18
- '@xto/base/es/style.css': resolve(__dirname, 'node_modules/@xto/base/es/style.css'),
19
- '@xto/form/es/style.css': resolve(__dirname, 'node_modules/@xto/form/es/style.css'),
20
- '@xto/data/es/style.css': resolve(__dirname, 'node_modules/@xto/data/es/style.css'),
21
- '@xto/feedback/es/style.css': resolve(__dirname, 'node_modules/@xto/feedback/es/style.css'),
22
- '@xto/navigation/es/style.css': resolve(__dirname, 'node_modules/@xto/navigation/es/style.css'),
23
- '@xto/layout/es/style.css': resolve(__dirname, 'node_modules/@xto/layout/es/style.css'),
24
- '@xto/business/es/style.css': resolve(__dirname, 'node_modules/@xto/business/es/style.css'),
25
- }
26
- },
27
- // 开发模式优化
28
- optimizeDeps: {
29
- include: [
30
- 'vue',
31
- 'vue-router',
32
- 'pinia',
33
- 'axios'
34
- ],
35
- exclude: [
36
- '@xto/core',
37
- '@xto/base',
38
- '@xto/form',
39
- '@xto/data',
40
- '@xto/feedback',
41
- '@xto/navigation',
42
- '@xto/layout',
43
- '@xto/business'
44
- ]
45
- },
46
- server: {
47
- host: '0.0.0.0',
48
- port: 3000,
49
- open: true,
50
- proxy: {
51
- '/api': {
52
- target: env.VITE_API_BASE_URL || 'http://localhost:8080',
53
- changeOrigin: true,
54
- rewrite: (path) => path.replace(/^\/api/, '')
55
- }
56
- }
57
- },
58
- build: {
59
- outDir: 'dist',
60
- sourcemap: false,
61
- chunkSizeWarningLimit: 1500,
62
- // 库模式配置 - 多入口构建
63
- lib: isLib ? {
64
- entry: {
65
- index: resolve(__dirname, 'src/index.ts'),
66
- api: resolve(__dirname, 'src/api/index.ts')
67
- },
68
- name: 'XtoFronted',
69
- formats: ['es']
70
- } : undefined,
71
- rollupOptions: {
72
- // 库模式下排除外部依赖
73
- external: isLib ? [
74
- 'vue',
75
- 'vue-router',
76
- 'pinia',
77
- 'axios',
78
- /^@xto\//
79
- ] : undefined,
80
- output: isLib ? {
81
- exports: 'named',
82
- // 自定义输出文件名
83
- entryFileNames: (chunkInfo) => {
84
- if (chunkInfo.name === 'api') {
85
- return 'api/index.js'
86
- }
87
- return 'index.js'
88
- }
89
- } : {
90
- manualChunks(id) {
91
- // Vue 全家桶单独打包
92
- if (id.includes('node_modules/vue/') ||
93
- id.includes('node_modules/@vue/') ||
94
- id.includes('node_modules/vue-router/') ||
95
- id.includes('node_modules/pinia/')) {
96
- return 'vue-vendor'
97
- }
98
- // 组件库按包分割,实现按需加载
99
- if (id.includes('@xto/core')) {
100
- return 'xto-core'
101
- }
102
- if (id.includes('@xto/base')) {
103
- return 'xto-base'
104
- }
105
- if (id.includes('@xto/form')) {
106
- return 'xto-form'
107
- }
108
- if (id.includes('@xto/data')) {
109
- return 'xto-data'
110
- }
111
- if (id.includes('@xto/feedback')) {
112
- return 'xto-feedback'
113
- }
114
- if (id.includes('@xto/navigation')) {
115
- return 'xto-navigation'
116
- }
117
- if (id.includes('@xto/layout')) {
118
- return 'xto-layout'
119
- }
120
- if (id.includes('@xto/business')) {
121
- return 'xto-business'
122
- }
123
- // 其他第三方库
124
- if (id.includes('node_modules/')) {
125
- return 'vendor'
126
- }
127
- }
128
- }
129
- }
130
- },
131
- css: {
132
- preprocessorOptions: {
133
- scss: {
134
- api: 'modern-compiler'
135
- }
136
- }
137
- }
138
- }
139
- })
1
+ import { defineConfig, loadEnv } from 'vite'
2
+ import vue from '@vitejs/plugin-vue'
3
+ import dts from 'vite-plugin-dts'
4
+ import { resolve } from 'path'
5
+
6
+ export default defineConfig(({ mode }) => {
7
+ const env = loadEnv(mode, process.cwd())
8
+ const isLib = mode === 'lib'
9
+
10
+ return {
11
+ plugins: [
12
+ vue(),
13
+ ...(isLib ? [dts({ insertTypesEntry: true, outDir: 'dist' })] : [])
14
+ ],
15
+ resolve: {
16
+ alias: {
17
+ '@': resolve(__dirname, 'src'),
18
+ '@xto/base/es/style.css': resolve(__dirname, 'node_modules/@xto/base/es/style.css'),
19
+ '@xto/form/es/style.css': resolve(__dirname, 'node_modules/@xto/form/es/style.css'),
20
+ '@xto/data/es/style.css': resolve(__dirname, 'node_modules/@xto/data/es/style.css'),
21
+ '@xto/feedback/es/style.css': resolve(__dirname, 'node_modules/@xto/feedback/es/style.css'),
22
+ '@xto/navigation/es/style.css': resolve(__dirname, 'node_modules/@xto/navigation/es/style.css'),
23
+ '@xto/layout/es/style.css': resolve(__dirname, 'node_modules/@xto/layout/es/style.css'),
24
+ '@xto/business/es/style.css': resolve(__dirname, 'node_modules/@xto/business/es/style.css'),
25
+ }
26
+ },
27
+ // 开发模式优化
28
+ optimizeDeps: {
29
+ include: [
30
+ 'vue',
31
+ 'vue-router',
32
+ 'pinia',
33
+ 'axios'
34
+ ],
35
+ exclude: [
36
+ '@xto/core',
37
+ '@xto/base',
38
+ '@xto/form',
39
+ '@xto/data',
40
+ '@xto/feedback',
41
+ '@xto/navigation',
42
+ '@xto/layout',
43
+ '@xto/business'
44
+ ]
45
+ },
46
+ server: {
47
+ host: '0.0.0.0',
48
+ port: 3000,
49
+ open: true,
50
+ proxy: {
51
+ '/api': {
52
+ target: env.VITE_API_BASE_URL || 'http://localhost:8080',
53
+ changeOrigin: true,
54
+ rewrite: (path) => path.replace(/^\/api/, '')
55
+ }
56
+ }
57
+ },
58
+ build: {
59
+ outDir: 'dist',
60
+ sourcemap: false,
61
+ chunkSizeWarningLimit: 1500,
62
+ // 库模式配置 - 多入口构建
63
+ lib: isLib ? {
64
+ entry: {
65
+ index: resolve(__dirname, 'src/index.ts'),
66
+ api: resolve(__dirname, 'src/api/index.ts')
67
+ },
68
+ name: 'XtoFronted',
69
+ formats: ['es']
70
+ } : undefined,
71
+ rollupOptions: {
72
+ // 库模式下排除外部依赖
73
+ external: isLib ? [
74
+ 'vue',
75
+ 'vue-router',
76
+ 'pinia',
77
+ 'axios',
78
+ /^@xto\//
79
+ ] : undefined,
80
+ output: isLib ? {
81
+ exports: 'named',
82
+ // 自定义输出文件名
83
+ entryFileNames: (chunkInfo) => {
84
+ if (chunkInfo.name === 'api') {
85
+ return 'api/index.js'
86
+ }
87
+ return 'index.js'
88
+ }
89
+ } : {
90
+ manualChunks(id) {
91
+ // Vue 全家桶单独打包
92
+ if (id.includes('node_modules/vue/') ||
93
+ id.includes('node_modules/@vue/') ||
94
+ id.includes('node_modules/vue-router/') ||
95
+ id.includes('node_modules/pinia/')) {
96
+ return 'vue-vendor'
97
+ }
98
+ // 组件库按包分割,实现按需加载
99
+ if (id.includes('@xto/core')) {
100
+ return 'xto-core'
101
+ }
102
+ if (id.includes('@xto/base')) {
103
+ return 'xto-base'
104
+ }
105
+ if (id.includes('@xto/form')) {
106
+ return 'xto-form'
107
+ }
108
+ if (id.includes('@xto/data')) {
109
+ return 'xto-data'
110
+ }
111
+ if (id.includes('@xto/feedback')) {
112
+ return 'xto-feedback'
113
+ }
114
+ if (id.includes('@xto/navigation')) {
115
+ return 'xto-navigation'
116
+ }
117
+ if (id.includes('@xto/layout')) {
118
+ return 'xto-layout'
119
+ }
120
+ if (id.includes('@xto/business')) {
121
+ return 'xto-business'
122
+ }
123
+ // 其他第三方库
124
+ if (id.includes('node_modules/')) {
125
+ return 'vendor'
126
+ }
127
+ }
128
+ }
129
+ }
130
+ },
131
+ css: {
132
+ preprocessorOptions: {
133
+ scss: {
134
+ api: 'modern-compiler'
135
+ }
136
+ }
137
+ }
138
+ }
139
+ })