Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何配置才能不使用{}解构,而是直接导入 #747

Open
5 tasks done
dsmelon opened this issue Apr 26, 2024 · 1 comment
Open
5 tasks done

如何配置才能不使用{}解构,而是直接导入 #747

dsmelon opened this issue Apr 26, 2024 · 1 comment

Comments

@dsmelon
Copy link

dsmelon commented Apr 26, 2024

Describe the bug

由于组件库没有按需导出所有组件,我想从它的目录按需导入,如何配置才能实现,例如以下写法
import SelfButton from '@self/component/button'
import SelfForm from '@self/component/form'

Reproduction

System Info

version: 0.21.2

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.
@kuolemax
Copy link

kuolemax commented May 5, 2024

不知道我的方案适不适用于你的情况,
例如我是用 vue-echarts 这个库,
需要 import VChart from vue-echarts
我配置成这样可以正确使用

Components({
  dts: true,
  resolvers: [
    (componentName: string) => {
      if (componentName === 'VChart')
        return 'vue-echarts'
    },
  ],
}),

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants