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

[vite v5] vite v5 与 v4.5.0 的 HMR 表现不一致,容易 circular imports detected,热更新失败 #15117

Closed
7 tasks done
mizi-lin opened this issue Nov 23, 2023 · 1 comment

Comments

@mizi-lin
Copy link

Describe the bug

// home.tsx 
// route { path: '/',  component: './home.tsx'  }
// url: http://localhost:5173/?a=asasas

import { useQuery } from '~ck';

const Home = () => {
    const [{ a }] = useQuery();
    return (
        <article>
            <header>Home 1111 {a}</header>
        </article>
    );
};

export default Home;

vite 5 现象1

手动修改代码 Home 1111
在 vite v5 中 会陷入 circular imports detected

image

其中 .caokong/src/index.ts 是一个本地统一的导出文件
image

vite 5 现象2

若将 import { useQuery } from '~ck'; 改成直接引入 import { useQuery } from '~ck/hooks/use-query'; 再改动代码,就不会触发 circular imports detected

image

在 vite v4.5.0 中的现象

image

期望

与 vite v4.5.0 表现一致,否则容易修改代码的时候 容易 page reload

Reproduction

N/A

Steps to reproduce

No response

System Info

System:
    OS: macOS 13.0
    CPU: (12) arm64 Apple M2 Max
    Memory: 56.97 MB / 32.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 3.5.1 - /usr/local/bin/yarn
    npm: 9.8.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 117.0.5938.149
    Safari: 16.1
  npmPackages:
    @vitejs/plugin-react-swc: 3.3.2 => 3.3.2
    vite: 5.0.2 => 5.0.2

Used Package Manager

yarn

Logs

No response

Validations

@bluwy
Copy link
Member

bluwy commented Nov 23, 2023

Duplicate of #15053

@bluwy bluwy marked this as a duplicate of #15053 Nov 23, 2023
@bluwy bluwy closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Dec 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants