Skip to content

Vite > v0.20.2: Can't find /@/playground/vite/hmr #357

Closed
@m4rvr

Description

@m4rvr

Describe the bug

After upgrading to version 0.20.5 (or anything greater than 0.20.2) I get a 404 error for the hmr import GET http://localhost:3000/@/playground/vite/hmr net::ERR_ABORTED 404 (Not Found).

The compiled App.vue looks like this:

import { defineComponent } from "/@modules/vue.js";
const __script = defineComponent({});

import { updateStyle } from "/@/playground/vite/hmr";

import { render as __render } from "/@/playground/App.vue?type=template";
__script.render = __render;
__script.__hmrId = "/@/playground/App.vue";
__script.__file = "D:\\test\\playground\\App.vue";
export default __script;

I have the dev environment in a separate folder called playground but the vite.config.ts is in the root. Before the upgrade it worked fine but now it fails.

The vite.config.ts looks like this:

import type { UserConfig } from "vite";
import { resolve } from "path";

const config: UserConfig = {
  root: resolve(__dirname, "playground"),
  alias: {
    "/@/": __dirname
  }
};

export default config;

Could the relative path from hmrClientPublicPath be the problem here?

Reproduction

https://github.com/MarvinRudolph/vite-hmr-bug

System Info

  • required vite version: > 0.20.2
  • required Operating System: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions