Eslint: "process" and "require" undefined error in web side

We are noticing eslint errors in /src/web js files when using process.env.FOO and require are undefined (‘process’/‘require’ is not defined. eslint no-undef rule) in the auth playground app.

Redwood eslint-config seems to define browser and es6 only as envs for web.

What is the proper way to get eslint to accept process on the web side when using env vars? (as to require, maybe we are supposed to be using es6 and not commonjs?)

@clairefro I’ve started seeing this behavior recently (maybe ~1-2 releases ago?) as well.

Ideas why this might be @peterp @danny?

1 Like

This is my bad. I tried to tighten the environments for the different sides, but I forgot that you can use process and require in webpack.

I think we can add these as globals, it would be amazing if we had a custom typescript type that actually added the env-vars that are available.

You could add them here:


@clairefro and @peterp PR fix(eslint): Adds process and require to eslint config web by dthyresson · Pull Request #2354 · redwoodjs/redwood · GitHub addresses this with a target of the 0.31 release.