Skip to content

在 vuepress 中无法使用 #559

@WangJincheng4869

Description

@WangJincheng4869

Describe the bug

添加了如下扫描,发现目录中的内容无法生成到自动导入文件中,但是默认的 vue 等这些标准的可以。

(可以确认生成的路径是正确的,我通过控制台打印结果得知)

Image

所以导致文档中演示组件会报错找不到类,并且也无法打包。下面的 fileUtils 就是在演示的组件中自动导入的工具类。

ncaught (in promise) ReferenceError: fileUtils is not defined
    at ComputedRefImpl.fn (SpFile.vue:43:3)
    at refreshComputed (reactivity.esm-bundler.js:380:28)
    at get value (reactivity.esm-bundler.js:1631:5)
    at unref (reactivity.esm-bundler.js:1476:29)
    at Object.get (reactivity.esm-bundler.js:1482:64)
    at Proxy._sfc_render (SpFile.vue:64:25)
    at renderComponentRoot (runtime-core.esm-bundler.js:6502:16)
    at ReactiveEffect.componentUpdateFn [as fn] (runtime-core.esm-bundler.js:5319:46)
    at ReactiveEffect.run (reactivity.esm-bundler.js:225:19)
    at setupRenderEffect (runtime-core.esm-bundler.js:5454:5)

Reproduction

https://github.com/WangJincheng4869/fanKuiWenJian/tree/main/packages/vite-auto-imports-vuepress

Image

System Info

System:
    OS: Windows 11 10.0.26100
    CPU: (24) x64 AMD Ryzen 9 9900X 12-Core Processor
    Memory: 27.60 GB / 47.63 GB
  Binaries:
    Node: 22.11.0 - D:\Program Files\nodejs\node.EXE
    npm: 9.4.0 - D:\Users\jcwang\AppData\Roaming\npm\npm.CMD
    pnpm: 10.5.2 - D:\Users\jcwang\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (128.0.2739.42)
    Internet Explorer: 11.0.26100.1882

Used Package Manager

pnpm

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