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

在vue3中使用ICON_CONFIGS默认值为undefined #167

Closed
lhlyu opened this issue Feb 27, 2021 · 7 comments
Closed

在vue3中使用ICON_CONFIGS默认值为undefined #167

lhlyu opened this issue Feb 27, 2021 · 7 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@lhlyu
Copy link

lhlyu commented Feb 27, 2021

代码如下: demo.vue

<template>
    <div>
        <More></More>
    </div>
</template>

<script lang="ts">
import { More } from '@icon-park/vue-next'

export default {
    components: {
        More
    },
    setup() {
        return {}
    }
}
</script>
  • 页面报错

image

  • debugger

image

@lhlyu lhlyu changed the title 在不二 在vue3中使用默认值为undefined Feb 27, 2021
@lhlyu lhlyu changed the title 在vue3中使用默认值为undefined 在vue3中使用ICON_CONFIGS默认值为undefined Feb 27, 2021
@lhlyu
Copy link
Author

lhlyu commented Feb 27, 2021

@dewfall123 不确定是不是vitepress-for-component导致的问题,因为我用ahooks-vue项目去测试也会报这个错误

@liuxuanzy
Copy link
Collaborator

你们用的是哪个版本胡图标库,能不能给个可复现的Demo。我用1.3.0版本没有问题。

@lhlyu lhlyu closed this as completed Feb 28, 2021
@AppleMonkey2019
Copy link
Member

hello,同学,这个事情最终解决了吗?

@lhlyu lhlyu reopened this Feb 28, 2021
@lhlyu
Copy link
Author

lhlyu commented Feb 28, 2021

@liuxuanzy @AppleMonkey2019
没有解决,我写了一个demo
版本是: v1.3.0

@AppleMonkey2019
Copy link
Member

好嘞,我们尽快看下

@AppleMonkey2019 AppleMonkey2019 self-assigned this Feb 28, 2021
@AppleMonkey2019 AppleMonkey2019 added the bug Something isn't working label Feb 28, 2021
@liuxuanzy
Copy link
Collaborator

我看了一下,是vitepress-for-component的问题,里面的vite配置将vue/runtime-core和vue/runtime-dom打包到了icon-park里面(你可以在node_modules/.vite下找到)但是在其他引用这两个包的地方,又重新通过esm加载了一份,造成了问题。
通过修改:vitepress-for-component/dist/node/server.js 第15行,增加以下代码可以解决
optimizeDeps:{
exclude:['@icon-park/vue-next']
}

以下代码也可以
optimizeDeps:{
include:['vue']
}

所以我判定这大概率是一个vite配置引起的问题。

@lhlyu
Copy link
Author

lhlyu commented Feb 28, 2021

include:['vue']

已验证,谢谢大佬

@lhlyu lhlyu closed this as completed Feb 28, 2021
@AppleMonkey2019 AppleMonkey2019 added help wanted Extra attention is needed and removed bug Something isn't working labels Feb 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants