https://www.growthbook.io/ logo
v

victorious-afternoon-95644

09/07/2023, 1:48 PM
Hey 🙋🏻‍♂️ I’m getting a “process is not defined” error when using the Javascript SDK in the browser.
process
is obviously not defined in browsers, am I missing something?
f

future-teacher-7046

09/07/2023, 1:49 PM
Are you using a bundler for your javascript? Most of them remove those lines automatically during the build process. We have them so when you do a dev build (
NODE_ENV=development
), we include much more verbose logging while keeping the production build small.
v

victorious-afternoon-95644

09/07/2023, 1:52 PM
Using
tsc
and
rollup
f

future-teacher-7046

09/07/2023, 2:04 PM
Ok. Most rollup configs have that already by default, but it's possible yours is missing that step.
Copy code
plugins: [
    replace({
      "process.env.NODE_ENV": JSON.stringify("production"),
      preventAssignment: true,
    }),
  ]
v

victorious-afternoon-95644

09/07/2023, 2:09 PM
Thanks! that solved it