Specifically I am not super clear why it's looking...
# ask-questions
Specifically I am not super clear why it's looking for the process variable like it was running in a Node environment. I don't see documentation at the moment about what I need to do in order to get it to work in "browser mode"
Usually, the
code is removed by whatever code bundler you are using - webpack, rollup, etc.
Really strange. I am actually using Rollup in this instance for what it's worth.
Ok, you might need to add a plugin to Rollup. Should look something like this:
Copy code
plugins: [
      "process.env.NODE_ENV": JSON.stringify("production"),
      preventAssignment: true,
Frameworks like Next.js automatically add this to the bundler, but it looks like Lit is more barebones and doesn't include anything by default
Let me take a stab at that one 😉 thank you so much for the pointer though, I had no chance of figuring that out on my own
Jeremy! Thank you again so much for that one I really appreciate it. It now looks to be working!
We can add a note to the docs about this. I'm sure you aren't the only one who's using Lit or another framework without a built in bundler.
Honestly it may be a good idea! Just from an onboarding perspective it's the kind of thing that can kill momentum pretty quickly without enough motivation. If it's any help at all the simple demo I put together has 2 examples of this. The first is here where I am using Rollup for a production build using the code you mentioned to me. https://github.com/mark-looptimize/growthbook-demo/blob/main/rollup.config.js#L31 and the second is in a local development environment where I am using something that is quite popular in the Lit community at least called
that is implemented like so https://github.com/mark-looptimize/growthbook-demo/blob/main/web-dev-server.config.mjs#L24 and finally a 60 line example implementation using a Lit pattern for code composition they call ReactiveControllers https://github.com/mark-looptimize/growthbook-demo/blob/main/src/feature-controller.ts