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

plugin-react-refresh requires Node 14.0.0 #1851

Closed
hmaurer opened this issue Feb 2, 2021 · 2 comments
Closed

plugin-react-refresh requires Node 14.0.0 #1851

hmaurer opened this issue Feb 2, 2021 · 2 comments

Comments

@hmaurer
Copy link

hmaurer commented Feb 2, 2021

I don't know if this classifies as a bug or as an enhancement.

Describe the bug

A recent commit on plugin-react-refresh introduced a use of optional chaining, which requires Node 14+. Vite's documentation specifies that Node 12+ is required. This may be true for Vite itself but isn't true anymore for Vite React projects.

Reproduction

Initialize a vitejs project with plugin-react-refresh 1.2.0 on Node 12.x, run npm run dev, and observe:

/node_modules/@vitejs/plugin-react-refresh/index.js:81
          plugins: opts?.parserPlugins
                        ^

SyntaxError: Unexpected token '.'

Potential fixes

  • Update documentation to indicate that Node 14+ is required for Vite React projects
  • OR remove the use of optional chaining
  • OR switch plugin-react-refresh to TypeScript so optional chaining gets transpiled

System Info

  • vite version: 2.0.0-beta.61
  • Operating System: MacOS Catalina
  • Node version: v12.18.4
  • Package manager (npm/yarn/pnpm) and version: NPM v6.14.6
@hmaurer
Copy link
Author

hmaurer commented Feb 2, 2021

PS: are PRs for things like this welcome?

@yyx990803
Copy link
Member

I forgot this file is un-transpiled!

@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
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