|
...
|
...
|
@@ -2,21 +2,68 @@ |
|
2
|
2
|
* Introduces component library styles on demand.
|
|
3
|
3
|
* https://github.com/anncwb/vite-plugin-style-import
|
|
4
|
4
|
*/
|
|
|
5
|
+ import styleImport from 'vite-plugin-style-import';
|
|
5
|
6
|
|
|
6
|
|
-import styleImport from 'vite-plugin-style-import';
|
|
7
|
|
-
|
|
8
|
|
-export function configStyleImportPlugin(isBuild: boolean) {
|
|
9
|
|
- if (!isBuild) return [];
|
|
10
|
|
- const styleImportPlugin = styleImport({
|
|
11
|
|
- libs: [
|
|
12
|
|
- {
|
|
13
|
|
- libraryName: 'ant-design-vue',
|
|
14
|
|
- esModule: true,
|
|
15
|
|
- resolveStyle: (name) => {
|
|
16
|
|
- return `ant-design-vue/es/${name}/style/index`;
|
|
17
|
|
- },
|
|
18
|
|
- },
|
|
19
|
|
- ],
|
|
20
|
|
- });
|
|
21
|
|
- return styleImportPlugin;
|
|
22
|
|
-} |
|
|
7
|
+ export function configStyleImportPlugin(isBuild: boolean) {
|
|
|
8
|
+ if (!isBuild) {
|
|
|
9
|
+ return [];
|
|
|
10
|
+ }
|
|
|
11
|
+ const styleImportPlugin = styleImport({
|
|
|
12
|
+ libs: [
|
|
|
13
|
+ {
|
|
|
14
|
+ libraryName: 'ant-design-vue',
|
|
|
15
|
+ esModule: true,
|
|
|
16
|
+ resolveStyle: (name) => {
|
|
|
17
|
+ // 这里是“子组件”列表,无需额外引入样式文件
|
|
|
18
|
+ const ignoreList = [
|
|
|
19
|
+ 'typography-text',
|
|
|
20
|
+ 'typography-title',
|
|
|
21
|
+ 'typography-paragraph',
|
|
|
22
|
+ 'typography-link',
|
|
|
23
|
+ 'anchor-link',
|
|
|
24
|
+ 'sub-menu',
|
|
|
25
|
+ 'menu-item',
|
|
|
26
|
+ 'menu-item-group',
|
|
|
27
|
+ 'dropdown-button',
|
|
|
28
|
+ 'breadcrumb-item',
|
|
|
29
|
+ 'breadcrumb-separator',
|
|
|
30
|
+ 'input-password',
|
|
|
31
|
+ 'input-search',
|
|
|
32
|
+ 'input-group',
|
|
|
33
|
+ 'form-item',
|
|
|
34
|
+ 'radio-group',
|
|
|
35
|
+ 'checkbox-group',
|
|
|
36
|
+ 'layout-sider',
|
|
|
37
|
+ 'layout-content',
|
|
|
38
|
+ 'layout-footer',
|
|
|
39
|
+ 'layout-header',
|
|
|
40
|
+ 'step',
|
|
|
41
|
+ 'select-option',
|
|
|
42
|
+ 'select-opt-group',
|
|
|
43
|
+ 'card-grid',
|
|
|
44
|
+ 'card-meta',
|
|
|
45
|
+ 'collapse-panel',
|
|
|
46
|
+ 'descriptions-item',
|
|
|
47
|
+ 'list-item',
|
|
|
48
|
+ 'list-item-meta',
|
|
|
49
|
+ 'table-column',
|
|
|
50
|
+ 'table-column-group',
|
|
|
51
|
+ 'tab-pane',
|
|
|
52
|
+ 'tab-content',
|
|
|
53
|
+ 'timeline-item',
|
|
|
54
|
+ 'tree-node',
|
|
|
55
|
+ 'skeleton-input',
|
|
|
56
|
+ 'skeleton-avatar',
|
|
|
57
|
+ 'skeleton-title',
|
|
|
58
|
+ 'skeleton-paragraph',
|
|
|
59
|
+ 'skeleton-image',
|
|
|
60
|
+ 'skeleton-button',
|
|
|
61
|
+ ];
|
|
|
62
|
+ return ignoreList.includes(name) ? '' : `ant-design-vue/es/${name}/style/index`;
|
|
|
63
|
+ },
|
|
|
64
|
+ },
|
|
|
65
|
+ ],
|
|
|
66
|
+ });
|
|
|
67
|
+ return styleImportPlugin;
|
|
|
68
|
+ } |
|
|
69
|
+ |
|
|
\ No newline at end of file |
...
|
...
|
|