Skip to content

组件库是export default形式导出的编译报错 #818

@aWhver

Description

@aWhver

Describe the bug

1、公司有自己的组件库开发团队,但是所有组件都是export default ,没有添加export {}/
2、使用插件处理时,最终编译后是这种import {AButton as __unplugin_components_1} from "/node_modules/.vite/deps/@a-button_lib_index__js.js?v=9f7b1eed";
3、但是文件a-button_lib_index__js.js里面导出的是这种形式export {
lib_default as default
// 如果添加了export { AButton } 这里会多一个下面的导出
lib_default as AButton
};
导致编译的时候直接报错:
SyntaxError: The requested module '/node_modules/.vite/deps/a-button_lib_index__js.js?v=9f7b1eed' does not provide an export named 'AButton
请问如何解决组件没有用export {}而是用export default的形式导出可以正常按需导入

Reproduction

Reproduction

System Info

windows

Used Package Manager

yarn

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy