Webpack encore process not defined

40 Views Asked by At

I am trying to add JS functionality to a project that needs env variables to work properly. Basic project structure is as

- assets/ (cs / js)
- src/ (php stuff)
.env
webpack.config.js

When I add process.env.key to js files in assets I get error 'process' is not defined running yarn build/dev/watch.

I have tried following suggestions found:

  1. dotenv
  2. dotenv-webpack
  3. this other example

But all result in 'process not defined' on compile.

What might I be missing here? How do I debug the yarn build process?

0

There are 0 best solutions below