react-contexify icon indicating copy to clipboard operation
react-contexify copied to clipboard

Uncaught ReferenceError: process is not defined

Open draibolit opened this issue 4 years ago • 4 comments

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',
      }),
  ],

draibolit avatar Feb 24 '21 11:02 draibolit

same error when using vite

tarnishablec avatar Apr 27 '21 10:04 tarnishablec

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.

itsthekeming avatar May 04 '21 01:05 itsthekeming

When use vite

Add the following config in vite config file:

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

jjshe avatar Feb 24 '22 09:02 jjshe

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

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

JonathanMEdwards avatar May 01 '22 22:05 JonathanMEdwards

The use of process will be removed.

fkhadra avatar Nov 03 '22 19:11 fkhadra