Commit 8b00112d5a7142bb33b982baade2831647f8e16f
1 parent
853bde92
fix: direct import for antdv subcomponents supported
修复直接import部分antdv子组件时会在build过程中报错的问题
Showing
2 changed files
with
47 additions
and
1 deletions
CHANGELOG.zh_CN.md
@@ -19,6 +19,7 @@ | @@ -19,6 +19,7 @@ | ||
19 | - **其它** | 19 | - **其它** |
20 | - 修复多标签在某些情况下关闭页签不会跳转路由的问题 | 20 | - 修复多标签在某些情况下关闭页签不会跳转路由的问题 |
21 | - 修复部分组件可能会造成热更新异常的问题 | 21 | - 修复部分组件可能会造成热更新异常的问题 |
22 | + - 修复直接`import`部分`antdv`子组件时会在 build 过程中报错的问题,如:TabPane、RadioGroup | ||
22 | 23 | ||
23 | ## 2.7.2(2021-09-14) | 24 | ## 2.7.2(2021-09-14) |
24 | 25 |
build/vite/plugin/styleImport.ts
@@ -14,7 +14,52 @@ export function configStyleImportPlugin(isBuild: boolean) { | @@ -14,7 +14,52 @@ export function configStyleImportPlugin(isBuild: boolean) { | ||
14 | libraryName: 'ant-design-vue', | 14 | libraryName: 'ant-design-vue', |
15 | esModule: true, | 15 | esModule: true, |
16 | resolveStyle: (name) => { | 16 | resolveStyle: (name) => { |
17 | - return `ant-design-vue/es/${name}/style/index`; | 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`; | ||
18 | }, | 63 | }, |
19 | }, | 64 | }, |
20 | ], | 65 | ], |