我已经设置了一个 pnpm 工作区,其中包含许多我添加为 git 子模块的项目。
之前工作的 Nuxt 项目突然开始出现错误The request url * is outside of Vite serving allow list
对于多个文件,包括作为 pnpm 模块安装的依赖项工作区 node_modules
folder.
唯一的变化是将我的项目初始化为 git 存储库。
我期望开发服务器继续工作,并且对 git 的更改不会产生任何影响。
该项目仍然构建正常。
这是推荐方式 https://vitejs.dev/config/server-options.html#server-fs-allow :
import { defineConfig, searchForWorkspaceRoot } from 'vite'
export default defineConfig({
server: {
fs: {
allow: [
// search up for workspace root
searchForWorkspaceRoot(process.cwd()),
// your custom rules
'/path/to/custom/allow',
],
},
},
})
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)