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

Uncaught ReferenceError: process is not defined #174

Closed
draibolit opened this issue Feb 24, 2021 · 5 comments
Closed

Uncaught ReferenceError: process is not defined #174

draibolit opened this issue Feb 24, 2021 · 5 comments

Comments

@draibolit
Copy link

The error happened when Webpack version 5 was used due to the fact that Webpack 5 removed the ability to access environment variables using the notation process.env.MY_ENV_VAR

My temporary solution:

npm install -D process

and add the following config in Webpack config file:

  plugins: [
      new webpack.ProvidePlugin({
             process: 'process/browser',
      }),
  ],

@tarnishablec
Copy link

same error when using vite

@itsthekeming
Copy link

same error when using vite

Hey, I encountered this same error and was able to fix it with this. Not sure what else it might break though.

@jjshe
Copy link

jjshe commented Feb 24, 2022

When use vite

Add the following config in vite config file:

export default defineConfig({
  define: {
    'process.env': {}
  }
})

@JonathanMEdwards
Copy link

JonathanMEdwards commented May 1, 2022

Happening with esbuild.
Adding this esbuild config doesn't help:

  define: {
    'process.env': {}
  }

@fkhadra
Copy link
Owner

fkhadra commented Nov 3, 2022

The use of process will be removed.

@fkhadra fkhadra added this to the v6.0.0 milestone Nov 3, 2022
fkhadra added a commit that referenced this issue Nov 3, 2022
@fkhadra fkhadra closed this as completed Nov 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants