Skip to content
This repository has been archived by the owner on Nov 30, 2022. It is now read-only.

Uncaught ReferenceError: process is not defined #2

Closed
csr632 opened this issue May 21, 2020 · 1 comment
Closed

Uncaught ReferenceError: process is not defined #2

csr632 opened this issue May 21, 2020 · 1 comment

Comments

@csr632
Copy link
Member

csr632 commented May 21, 2020

@react-refresh:16 Uncaught ReferenceError: process is not defined
    at @react-refresh:16

reproduce:
https://github.com/csr632/test-vite/tree/plugin-react

Investigate

The injection of window.process happens after importing '/@react-refresh'
https://github.com/vitejs/vite-plugin-react/blob/0dedc26c5cc3890524e3e9cb8a7d4f84297a3e1e/src/serverPlugin.ts#L49

image

So plugins that append module code into html should resolve process.env.NODE_ENV by themself.

@yyx990803
Copy link
Member

Fixed in 027c4a5

The React preamble needs to be injected after Vite's built-in preamble

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants