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: vite fs.strict 导致 webui 的 router 无法找到 path "/" #301

Closed
Lipraty opened this issue Jan 27, 2024 · 3 comments
Closed

Bug: vite fs.strict 导致 webui 的 router 无法找到 path "/" #301

Lipraty opened this issue Jan 27, 2024 · 3 comments
Labels
bug Something isn't working domain: console help wanted Extra attention is needed

Comments

@Lipraty
Copy link
Member

Lipraty commented Jan 27, 2024

Describe the bug

在尝试开发 webui 时,会遇到如下 terminal错误:

The request url "/workspace/path/node_modules/koishi-plugin-theme-vanilla/dist/style.css" is outside of Vite serving allow list.

- /workspace/path/external/webui
- /workspace/path/node_modules/vite/dist/client

Refer to docs https://vitejs.dev/config/server-options.html#server-fs-allow for configurations and more details.

The request url "/workspace/path/node_modules/koishi-plugin-dataview/dist/style.css" is outside of Vite serving allow list.
The request url "/workspace/path/node_modules/koishi-plugin-theme-vanilla/dist/index.js" is outside of Vite serving allow list.
The request url "/workspace/path/node_modules/koishi-plugin-dataview/dist/index.js" is outside of Vite serving allow list.
The request url "/workspace/path/node_modules/koishi-plugin-theme-vanilla/dist/style.css" is outside of Vite serving allow list.
The request url "/workspace/path/node_modules/koishi-plugin-dataview/dist/style.css" is outside of Vite serving allow list.

尝试修改配置项以关闭:

# koishi.yml

...
    console:lz8buy:
      open: false
      devMode: true
      dev:
        fs:
          strict: false
...

terminal 无报错,但浏览器循环在 console 输出 [Vue Router warn]: No match found for location with path "/"

应当是 fs.strict 导致 router 无法找到 path 的问题

Steps to reproduce

  1. 创建全新 bp
  2. 在 p.j 中删除 webui 相关依赖
  3. 使用 git clone https://github.com/koishijs/webui/git ./external/webui 下载 webui 仓库
  4. 使用 yarn dev 启动,此时 terminal 提示 The request url "/workspace/path/node_modules/koishi-plugin-theme-vanilla/dist/style.css" is outside of Vite serving allow list.
  5. 修改 koishi.ymlconsole.dev.fs.strict: false 关闭 strict
  6. terminal 无提示,但浏览器 console 提示 [Vue Router warn]: No match found for location with path "/"

Expected behavior

能够正常路由

Screenshots

No response

Versions

  • OS: Windows 11
  • Platform:
  • Node version: 20.9.0
  • Koishi version: 4.16.7

Additional context

No response

@Lipraty Lipraty added the bug Something isn't working label Jan 27, 2024
@shigma
Copy link
Member

shigma commented Jan 27, 2024

已复现。

前一半问题可能会考虑将 node_modules 引入默认的 allow list 来解决。

后一半的问题过于诡异,我没有研究出原因或解决办法。代码中唯一的 beforeEach 片段,我在里面打 console.log 有输出,但是我把代码注释掉依然会在此处报错。如果在其中断点会直接导致网页崩溃。

@shigma shigma transferred this issue from koishijs/koishi Jan 27, 2024
@shigma shigma added the help wanted Extra attention is needed label Jan 27, 2024
@shigma shigma closed this as completed in 250a969 Jan 27, 2024
@shigma
Copy link
Member

shigma commented Jan 27, 2024

不确定有没有修对。

@Lipraty
Copy link
Member Author

Lipraty commented Jan 28, 2024

fixed.

CyanChanges pushed a commit to CyanForks/webui that referenced this issue Feb 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working domain: console help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants