You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When running a Vue project using Vite, an error pops up "Uncaught ReferenceError: process is not defined" in reference to a line of code
// node_modules/@reown/appkit-core/dist/esm/src/utils/ConstantsUtil.js
var SECURE_SITE = process.env["NEXT_PUBLIC_SECURE_SITE_ORIGIN"] || "https://secure.walletconnect.org";
This breaks the app unless you add define: { 'process.env': process.env }, in vite.config.ts, which probably shouldn't be the solution to this. It took me a while to figure out this problem, others shouldn't experience this frustration.
Also, the Vue wagmi stackblitz fork link from the appkit-web-examples is broken during npm install. I had to make my own stackblitz example.
I faced an issue where a library tried to access process.env variables in a Vite app, but Vite doesn't automatically provide process.env in client-side code.
To resolve this, I used the vite-plugin-env-compatible polyfill, which makes process.env accessible in Vite projects.
npm install vite-plugin-env-compatible --save-dev
and add to vite.config.js
import EnvCompatible from 'vite-plugin-env-compatible';
export default {
plugins: [EnvCompatible()],
};
Link to minimal reproducible example
https://stackblitz.com/edit/sb1-khypems9?file=src%2Fviews%2FHome.vue
Summary
When running a Vue project using Vite, an error pops up "Uncaught ReferenceError: process is not defined" in reference to a line of code
This breaks the app unless you add
define: { 'process.env': process.env },
invite.config.ts
, which probably shouldn't be the solution to this. It took me a while to figure out this problem, others shouldn't experience this frustration.Also, the Vue wagmi stackblitz fork link from the
appkit-web-examples
is broken duringnpm install
. I had to make my own stackblitz example.List of related npm package versions
Node.js Version
v18.20.3
Package Manager
npm@10.2.3
The text was updated successfully, but these errors were encountered: