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

[Bug report] 开发环境下,修改文件 permalink 会导致 Failed to resolve import "xxx" #1526

Closed
pengzhanbo opened this issue Apr 5, 2024 · 7 comments
Assignees
Labels

Comments

@pengzhanbo
Copy link
Contributor

pengzhanbo commented Apr 5, 2024

Description

启动开发服务后,对 markdown 文件 frontmatter 字段的 permalink 进行修改,保存文件后,均会导致错误。

错误信息:

[plugin:vite:import-analysis] 
Failed to resolve import "/home/projects/vuepress-lc5skn/docs/.vuepress/.temp/pages/ff/ff/ff/index.html.js" 
from "docs/.vuepress/.temp/internal/routes.js". 
Does the file exist?

在重现中,修改 docs/permalink.md 文件即可重现该问题。

Reproduction

https://stackblitz.com/edit/vuepress-lc5skn?file=docs%2FREADME.md

Used Package Manager

pnpm

System Info

System:
    OS: Linux 5.0 undefined
    CPU: (4) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
    bun: Not Found
  Utilities:
    Git: Not Found
  Browsers:
    Chrome: Not Found
  npmPackages:
    @vuepress/bundler-vite: 2.0.0-rc.9 => 2.0.0-rc.9 
    @vuepress/bundler-webpack: Not Found
    @vuepress/cli: Not Found
    @vuepress/client: Not Found
    @vuepress/core: Not Found
    @vuepress/markdown: Not Found
    @vuepress/shared: Not Found
    @vuepress/utils: Not Found
    vue: ^3.4.21 => 3.4.21 
    vue-router: Not Found
    vuepress: 2.0.0-rc.9 => 2.0.0-rc.9
@Mister-Hope Mister-Hope added the bug Something isn't working label Apr 6, 2024
@Mister-Hope
Copy link
Member

I believe this issue is related to vite, as I can trigger similar issue on a normal HMR of .vue component

@pengzhanbo
Copy link
Contributor Author

我尝试在 vuepress 旧版本中重现该问题,发现在 rc.7 之前的版本无该问题,从 rc.8 开始出现该问题,
v2.0.0-rc.7...v2.0.0-rc.8 在 diff 中也未发现 潜在的引发该问题的代码修改。

在这两个版本之间,vite 版本 确实发生了 更新 , 因此我相信 该问题跟 vite 有关 是对的。

@meteorlxy
Copy link
Member

meteorlxy commented Apr 12, 2024

  bundler: viteBundler({
    viteOptions: {
      server: {
        fs: {
          cachedChecks: false,
        },
      },
    },
  }),

Ref: vitejs/vite#15784 (comment)

I just tried the snippet above in your repro link, and it's working well then. Not sure if we should set it as the default in bundler-vite pkg

@Mister-Hope
Copy link
Member

I think we should set it as default value

@NeonGooRoo
Copy link

  bundler: viteBundler({
    viteOptions: {
      server: {
        fs: {
          cachedChecks: false,
        },
      },
    },
  }),

Ref: vitejs/vite#15784 (comment)

I just tried the snippet above in your repro link, and it's working well then. Not sure if we should set it as the default in bundler-vite pkg

I have an issue in dev mode.

I added the code above, as well as import { viteBundler } from '@vuepress/bundler-vite' into theme.ts, it fixed the problem until I added new media again. After that, I just need to save the config.ts ts again (with no changes), so VScode restarts dev mode and problem fixes again.

@Mister-Hope
Copy link
Member

theme.ts

Are you sure you are doing the correct thing?

@NeonGooRoo
Copy link

theme.ts

Are you sure you are doing the correct thing?

I actually have no idea, sorry, I have no idea how Vue actually works and I have 0 programming experience

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

No branches or pull requests

4 participants