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-plugin-eslint is not compatible with virtual modules #535

Closed
1 task
hi-reeve opened this issue Dec 20, 2022 · 12 comments
Closed
1 task

vite-plugin-eslint is not compatible with virtual modules #535

hi-reeve opened this issue Dec 20, 2022 · 12 comments
Labels
upstream This is an issue with another package

Comments

@hi-reeve
Copy link

What version of vite are you using?

4.0.2

System info and storybook versions

Environment Info:

System:
OS: macOS 13.1
CPU: (8) arm64 Apple M1 Pro
Binaries:
Node: 18.12.0 - ~/.nvm/versions/node/v18.12.0/bin/node
npm: 8.19.2 - ~/.nvm/versions/node/v18.12.0/bin/npm
Browsers:
Safari: 16.2
npmPackages:
@storybook/addon-essentials: ^7.0.0-beta.12 => 7.0.0-beta.12
@storybook/addon-interactions: ^7.0.0-beta.12 => 7.0.0-beta.12
@storybook/addon-links: ^7.0.0-beta.12 => 7.0.0-beta.12
@storybook/blocks: ^7.0.0-beta.12 => 7.0.0-beta.12
@storybook/testing-library: ^0.0.13 => 0.0.13
@storybook/vue3: ^7.0.0-beta.12 => 7.0.0-beta.12
@storybook/vue3-vite: ^7.0.0-beta.12 => 7.0.0-beta.12

Describe the Bug

just install storybook on my project
trying to run storybook for the first time and got this error

image

Link to Minimal Reproducible Example

No response

Participation

  • I am willing to submit a pull request for this issue.
@hi-reeve hi-reeve added the bug Something isn't working label Dec 20, 2022
@hi-reeve hi-reeve changed the title [Bug] [Bug] failed to run storybook with vite 4 Dec 20, 2022
@IanVS
Copy link
Member

IanVS commented Dec 20, 2022

This appears to be a pnpm caching issue. If you can create a reproduction I can take a look. Others have tried and been unable to, which indicates there is something corrupted locally.

@hi-reeve
Copy link
Author

hi-reeve commented Dec 20, 2022

This appears to be a pnpm caching issue. If you can create a reproduction I can take a look. Others have tried and been unable to, which indicates there is something corrupted locally.

i resolve this by deleting node_modules and try to re-init storybook and it works fine now.
got other error

[vite] Internal server error: No ESLint configuration found in /virtual:/@storybook/builder-vite.
  Plugin: vite-plugin-eslint
  File: /virtual:/@storybook/builder-vite/vite-app.js
      at CascadingConfigArrayFactory._finalizeConfigArray (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/@eslint+eslintrc@1.4.0/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:521:19)
      at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/@eslint+eslintrc@1.4.0/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:312:21)
      at CLIEngine.isPathIgnored (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/eslint@8.30.0/node_modules/eslint/lib/cli-engine/cli-engine.js:989:18)
      at ESLint.isPathIgnored (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/eslint@8.30.0/node_modules/eslint/lib/eslint/eslint.js:681:26)
      at TransformContext.transform (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/vite-plugin-eslint@1.8.1_eslint@8.30.0+vite@4.0.2/node_modules/vite-plugin-eslint/dist/index.js:1:2348)
      at Object.transform (file:///Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/vite@4.0.2_gneikmxcpj2uc2xuqjosnroj4e/node_modules/vite/dist/node/chunks/dep-6305614c.js:42626:44)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async loadAndTransform (file:///Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/vite@4.0.2_gneikmxcpj2uc2xuqjosnroj4e/node_modules/vite/dist/node/chunks/dep-6305614c.js:40434:29)

@IanVS
Copy link
Member

IanVS commented Dec 21, 2022

Can you share a reproduction? I can't tell what's happening otherwise.

@woodreamz
Copy link

woodreamz commented Apr 13, 2023

This appears to be a pnpm caching issue. If you can create a reproduction I can take a look. Others have tried and been unable to, which indicates there is something corrupted locally.

i resolve this by deleting node_modules and try to re-init storybook and it works fine now. got other error

[vite] Internal server error: No ESLint configuration found in /virtual:/@storybook/builder-vite.
  Plugin: vite-plugin-eslint
  File: /virtual:/@storybook/builder-vite/vite-app.js
      at CascadingConfigArrayFactory._finalizeConfigArray (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/@eslint+eslintrc@1.4.0/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:521:19)
      at CascadingConfigArrayFactory.getConfigArrayForFile (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/@eslint+eslintrc@1.4.0/node_modules/@eslint/eslintrc/lib/cascading-config-array-factory.js:312:21)
      at CLIEngine.isPathIgnored (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/eslint@8.30.0/node_modules/eslint/lib/cli-engine/cli-engine.js:989:18)
      at ESLint.isPathIgnored (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/eslint@8.30.0/node_modules/eslint/lib/eslint/eslint.js:681:26)
      at TransformContext.transform (/Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/vite-plugin-eslint@1.8.1_eslint@8.30.0+vite@4.0.2/node_modules/vite-plugin-eslint/dist/index.js:1:2348)
      at Object.transform (file:///Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/vite@4.0.2_gneikmxcpj2uc2xuqjosnroj4e/node_modules/vite/dist/node/chunks/dep-6305614c.js:42626:44)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async loadAndTransform (file:///Users/reeve/Documents/reeve/Works/nostra-erp-webapp/node_modules/.pnpm/vite@4.0.2_gneikmxcpj2uc2xuqjosnroj4e/node_modules/vite/dist/node/chunks/dep-6305614c.js:40434:29)

@hi-reeve Did you find a solution? I am facing the same issue.

UPDATE: Finally found a solution by excluding /virtual:/

//vite.config.js
import { defineConfig } from 'vite';
import react from '@vitejs/plugin-react-swc';
import eslint from 'vite-plugin-eslint';

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    react(),
    eslint({
      exclude: ['/virtual:/**', 'node_modules/**'],
    }),
});

@IanVS
Copy link
Member

IanVS commented Apr 13, 2023

I suggest upgrading to Storybook 7 if you want to use vite 4, I never got it fully working back in Storybook 6.5.

@woodreamz
Copy link

woodreamz commented Apr 14, 2023

I suggest upgrading to Storybook 7 if you want to use vite 4, I never got it fully working back in Storybook 6.5.

The issue is still there with Storybook 7 (I am currently using 7.0.4).

    "eslint": "8.38.0",
    "eslint-plugin-react": "7.32.2",
    "eslint-plugin-react-hooks": "4.6.0",
    "eslint-plugin-storybook": "0.6.11",
    "eslint-plugin-testing-library": "5.10.2",
    "vite": "4.2.1",
    "vite-plugin-eslint": "1.8.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "@storybook/addon-essentials": "7.0.4",
    "@storybook/addon-interactions": "7.0.4",
    "@storybook/addon-links": "7.0.4",
    "@storybook/blocks": "7.0.4",
    "@storybook/react": "7.0.4",
    "@storybook/react-vite": "7.0.4",
    "@storybook/testing-library": "0.1.0",

@IanVS
Copy link
Member

IanVS commented Apr 14, 2023

OK, thanks. This repo is the code for the 6.5 version, which is why I thought you weren't using 7.

@jung-han
Copy link

@IanVS
Hi, I have same issue. Storybook version is 7.0.4 and vite version is 4.2.1.
The problem was solved by excluding as mentioned above(#535 (comment)), but I share it because it seems to be a temporary solution.

@tarik-gadoumi
Copy link

tarik-gadoumi commented Apr 15, 2023

Hi i have same issue :
"vite": "^4.2.1",
"storybook": "^7.0.4",
"vite-plugin-eslint": "^1.8.1"
"eslint": "^8.38.0",
"eslint-config-react-app": "^7.0.1",
"eslint-plugin-jsx-a11y": "^6.7.1",

@alextes90
Copy link

Hi, have the same issue:

"vite": "^4.1.0",
"vite-plugin-eslint": "^1.8.1",
"@storybook/react": "^7.0.10",
"@storybook/react-vite": "^7.0.10",
"eslint": "^8.36.0",

Solved, as written above. Thank you

@IanVS
Copy link
Member

IanVS commented May 10, 2023

This doesn't have anything to do with Storybook, it's an issue in vite-plugin-eslint that it cannot handle virtual files.

1 similar comment
@IanVS
Copy link
Member

IanVS commented May 10, 2023

This doesn't have anything to do with Storybook, it's an issue in vite-plugin-eslint that it cannot handle virtual files.

@IanVS IanVS added upstream This is an issue with another package and removed needs reproduction bug Something isn't working labels May 10, 2023
@IanVS IanVS changed the title [Bug] failed to run storybook with vite 4 vite-plugin-eslint is not compatible with virtual modules May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream This is an issue with another package
Projects
None yet
Development

No branches or pull requests

6 participants