vite: Parsing error: ESLint was configured to run on `/vite.config.ts` using `parserOptions.project`:
Describe the bug
pnpm create vite react typescript-swc
Reproduction
https://stackblitz.com/edit/vitejs-vite-psmxmw?file=tsconfig.node.json
Steps to reproduce
No response
System Info
OS: macOS 12.5.1
CPU: (8) arm64 Apple M1 Pro
Memory: 101.81 MB / 16.00 GB
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.16.0 - ~/.nvm/versions/node/v16.16.0/bin/node
Yarn: 1.22.19 - /opt/homebrew/bin/yarn
npm: 8.11.0 - ~/.nvm/versions/node/v16.16.0/bin/npm
pnpm: 8.5.1 - /opt/homebrew/bin/pnpm
Watchman: 2023.02.27.00 - /opt/homebrew/bin/watchman
Browsers:
Chrome: 114.0.5735.198
Safari: 15.6.1
npmPackages:
@vitejs/plugin-react-swc: ^3.3.2 => 3.3.2
vite: ^4.4.0 => 4.4.0
Used Package Manager
pnpm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 4
- Comments: 16 (1 by maintainers)
having the same issue inside src folder, another fix is to add
src
in ignorePatterns:ignorePatterns: [".eslintrc.cjs", "vite.config.ts", "src"],
in .eslintrc.cjs.Problem solved ./.eslintrc.cjs :change parserOptions.project to [‘./tsconfig.json’, ‘./tsconfig.node.json’]
https://github.com/vitejs/vite/issues/13747#issuecomment-1636870022
I have discovered a new solution !
./.eslintrc.cjs :change parserOptions.project to [‘./tsconfig.json’, ‘./tsconfig.node.json’]tsconfig.node.json
By the way, another thing: If you use node.js in vite
__dirname
is not defined in es module scopeYou need to modify it to the following code :
Having the same issue
This helped me for the time being
https://github.com/vitejs/vite/issues/13747#issuecomment-1626611687
Same issue but using yarn.
@vaynevayne I am having the same issue trying to start a new vite react typescript project.