-
-
Notifications
You must be signed in to change notification settings - Fork 24
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
LoadingComponent path error #5
Labels
bug
Something isn't working
Comments
vit路径下的routes文件中实际是以下内容 // @ts-nocheck
import { dynamic } from '@vitjs/runtime';
import React from 'react';
import SmileOutlined from '@ant-design/icons/SmileOutlined'
import BulbOutlined from '@ant-design/icons/BulbOutlined'
import UserOutlined from '@ant-design/icons/UserOutlined'
import LoadingComponent from 'C:\Users\zhang\Desktop\vite-react\src\components\PageLoading';
export default function getRoutes() {
const routes = [
{
"path": "/",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\layouts\\BlankLayout'), loading: LoadingComponent}),
"routes": [
{
"path": "/user",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\layouts\\UserLayout'), loading: LoadingComponent}),
"routes": [
{
"name": "登录",
"path": "/user/login",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\User\\Login'), loading: LoadingComponent}),
"exact": true
}
]
},
{
"path": "/",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\layouts\\SecurityLayout'), loading: LoadingComponent}),
"routes": [
{
"path": "/",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\layouts\\BasicLayout'), loading: LoadingComponent}),
"routes": [
{
"path": "/",
"redirect": "/welcome",
"exact": true
},
{
"path": "/welcome",
"icon": React.createElement(SmileOutlined),
"name": "欢迎页",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\Welcome'), loading: LoadingComponent}),
"exact": true
},
{
"path": "/concent",
"icon": React.createElement(BulbOutlined),
"name": "Concent Demo",
"routes": [
{
"path": "/concent/hello-world",
"name": "Hello World",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\Concent\\HelloWorld'), loading: LoadingComponent}),
"exact": true
}
]
},
{
"path": "/account",
"icon": React.createElement(UserOutlined),
"name": "个人页",
"routes": [
{
"path": "/account/center",
"name": "个人中心",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\Account\\Center'), loading: LoadingComponent}),
"exact": true
},
{
"path": "/account/settings",
"name": "个人设置",
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\Account\\Settings'), loading: LoadingComponent}),
"exact": true
}
]
}
]
},
{
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\404'), loading: LoadingComponent}),
"exact": true
}
]
},
{
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\404'), loading: LoadingComponent}),
"exact": true
}
]
},
{
"component": dynamic({ loader: () => import('C:\\Users\\zhang\\Desktop\\vite-react\\src\\pages\\404'), loading: LoadingComponent}),
"exact": true
}
];
return routes;
} |
感谢反馈,应该是 Windows 下生成组件路径没处理导致的,源码看这里 https://github.com/vitjs/vit/blob/b4fdc68ed00da3d47e441440ab487db60df120b3/packages/vit/src/generateFiles/routes.ts#L49 争取尽快处理,Windows 下的话可以选择暂时先不用代码分割,抑或 PR 一下 😄 |
已修复,在项目内更新 @vitjs 相关依赖即可 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The text was updated successfully, but these errors were encountered: