Skip to content

[vite] Internal server error: ENOENT: no such file or directory, open 'D:\@react-refresh' #1457

@DannyloAlves

Description

@DannyloAlves

Environment

  • Linaria version: 6.3.0
  • Bundler (+ version): Vite 7.1.9
  • Node.js version: 24.10.0
  • OS: Windows 10 Pro

Description

Whenever I install linaria + vite and save the project when it is running, the following error occurs on terminal:

[vite] Internal server error: ENOENT: no such file or directory, open 'D:@react-refresh'

Image

And the following error occurs in the browser:

[plugin:wyw-in-js] ENOENT: no such file or directory, open 'D:@react-refresh'

Image

Reproducible Demo

Install Vite:
npm create vite@latest .

Install Linaria:
npm install @linaria/core @linaria/react @wyw-in-js/babel-preset

Install WyW-in-JS plugin for Vite:
npm i -D @wyw-in-js/vite

Configure WyW-in-JS plugin for Vite:

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'
import wyw from '@wyw-in-js/vite';

// https://vite.dev/config/
export default defineConfig({
  plugins: [
    react(),
    wyw(),
  ],
})

I edit a simple template:

import { styled } from "@linaria/react"

const Container = styled.div`
  background-color: orange;
`;

function App() {
  return (
    <Container>
      Hello World
    </Container>
  )
}

export default App

I execute:
npm run dev

Everything works normally, but if I modify the code and save the project when it is running, the following error occurs in the terminal:

manually calling optimizeDeps is deprecated. This is done automatically and does not need to be called manually.
12:58:49 AM [vite] (client) hmr update /src/App.jsx
12:58:49 AM [vite] Internal server error: ENOENT: no such file or directory, open 'D:\@react-refresh'
  Plugin: wyw-in-js
  File: D:/Users/seth/Desktop/clonetest/src/App.jsx
      at Object.readFileSync (node:fs:440:20)
      at TransformCacheCollection.invalidateIfChanged (D:\Users\seth\Desktop\clonetest\node_modules\@wyw-in-js\transform\lib\cache.js:89:53)
      at Entrypoint.innerCreate (D:\Users\seth\Desktop\clonetest\node_modules\@wyw-in-js\transform\lib\transform\Entrypoint.js:104:54)
      at D:\Users\seth\Desktop\clonetest\node_modules\@wyw-in-js\transform\lib\transform\Entrypoint.js:85:47
      at EventEmitter.perf (D:\Users\seth\Desktop\clonetest\node_modules\@wyw-in-js\transform\lib\utils\EventEmitter.js:45:20)
      at Entrypoint.create (D:\Users\seth\Desktop\clonetest\node_modules\@wyw-in-js\transform\lib\transform\Entrypoint.js:84:25)
      at Entrypoint.createRoot (D:\Users\seth\Desktop\clonetest\node_modules\@wyw-in-js\transform\lib\transform\Entrypoint.js:62:32)
      at transform (D:\Users\seth\Desktop\clonetest\node_modules\@wyw-in-js\transform\lib\transform.js:98:45)
      at TransformPluginContext.transform (file:///D:/Users/seth/Desktop/clonetest/node_modules/@wyw-in-js/vite/esm/index.mjs:118:28)
      at EnvironmentPluginContainer.transform (file:///D:/Users/seth/Desktop/clonetest/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:31018:51)
      at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
      at async loadAndTransform (file:///D:/Users/seth/Desktop/clonetest/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:26143:26)
      at async viteTransformMiddleware (file:///D:/Users/seth/Desktop/clonetest/node_modules/vite/dist/node/chunks/dep-Chhhsdoe.js:27221:20)

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