We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
System: OS: Windows 10 10.0.19045 CPU: (12) x64 Intel(R) Core(TM) i7-8700 CPU @ 3.20GHz Memory: 9.09 GB / 31.83 GB Browsers: Edge: Spartan (44.19041.3636.0), Chromium (125.0.2535.92) Internet Explorer: 11.0.19041.3636 npmPackages: @modern-js/app-tools: 2.53.0 => 2.53.0 @modern-js/eslint-config: 2.53.0 => 2.53.0 @modern-js/plugin-ssg: 2.53.0 => 2.53.0 @modern-js/runtime: 2.53.0 => 2.53.0 @modern-js/tsconfig: 2.53.0 => 2.53.0
项目使用约定式路由,通过 assetPrefix参数修改资源路径至 github pages对应项目路径,可以打开页面,并正确跳转路由;但是跳转路由后刷新页面时会404,提示找不到页面,以下是 modern.config.ts内容(下方的 dist在打包时会替换为 项目名称):
import { appTools, defineConfig } from '@modern-js/app-tools'; // https://modernjs.dev/en/configure/app/usage export default defineConfig({ output: { distPath: { html: '', }, assetPrefix: '/../dist', }, html: { disableHtmlFolder: true, }, source: { mainEntryName: 'index', }, server: { baseUrl: '/dist', }, runtime: { router: { basename: '/dist', }, state: true, }, plugins: [ appTools({ bundler: 'experimental-rspack', }), ], });
The text was updated successfully, but these errors were encountered:
github page 是不是默认情况下不支持 SPA 的
Sorry, something went wrong.
好的,谢谢,我试试用404.html的方式来实现下看看
结合这篇文章解决了 GitHub Pages 如何实现 SPA; 不过在modernjs里面,index.html(入口组件中)中要用 useNavigate来进行跳转,不能用 history.replaceState
No branches or pull requests
版本信息
问题详情
项目使用约定式路由,通过 assetPrefix参数修改资源路径至 github pages对应项目路径,可以打开页面,并正确跳转路由;但是跳转路由后刷新页面时会404,提示找不到页面,以下是 modern.config.ts内容(下方的 dist在打包时会替换为 项目名称):
复现链接
复现步骤
The text was updated successfully, but these errors were encountered: