umi icon indicating copy to clipboard operation
umi copied to clipboard

[Bug] 开发环境下firefox浏览器window.location.href无法正常跳转到新页面

Open jsxiaosi opened this issue 1 year ago • 3 comments

What happens?

在config.ts中配置了routes之后,window.location.href开发环境下在firefox浏览器中并不会跳转到新地址,反而是刷新原来的地址

Mini Showcase Repository(REQUIRED)

Please provide a minimal reproduction then upload to your GitHub. 请提供 最小重现,并上传到你的 GitHub 仓库

https://github.com/jsxiaosi/umi-issues

export default function HomePage() {
  return (
    <div>
      <button onClick={() => {
        window.location.href = 'https://umijs.org/docs/guides/routes'
      }
      }>button</button>
    </div>
  );
}

How To Reproduce

Steps to reproduce the behavior: 1. 2.

Expected behavior 1. 2.

Context

  • Umi Version:
  • Node Version:
  • Platform:

jsxiaosi avatar Mar 07 '23 04:03 jsxiaosi

由于缺乏足够的信息,我们暂时关闭了该 Issue。请修改(不要回复) Issue 提供最小重现以重新开启。谢谢。

github-actions[bot] avatar Mar 07 '23 04:03 github-actions[bot]

用 chrome 开发,构建完的产物生产环境是正常的。

fz6m avatar Mar 07 '23 13:03 fz6m

这个问题我也遇到了,最终已解决:在package.json文件中命令添加cross-env HMR=none,火狐就可以正确跳转了

Payzlee001 avatar Nov 13 '23 05:11 Payzlee001