https://www.growthbook.io/ logo
#ask-questions
Title
# ask-questions
b

big-nightfall-62615

04/24/2022, 3:40 PM
Hi, I'm looking for more info regarding the following feature: Load at build-time (static generation) reference: https://docs.growthbook.io/app/features#load-at-build-time-static-generation
f

future-teacher-7046

04/24/2022, 3:41 PM
What framework are you using for static generation?
b

big-nightfall-62615

04/24/2022, 3:52 PM
react, nodejs
not using any framework
I thought it means a compile-time solution (react build)
f

future-teacher-7046

04/24/2022, 3:57 PM
Ok. The basic process is to fetch your feature definition JSON from the GrowthBook API and embed that in your JavaScript bundle. Then use the react SDK and pass in that JSON object.
The only different to the other approaches is that there's no network request to fetch the features and everything is bundled together with your app.
b

big-nightfall-62615

04/24/2022, 4:18 PM
do you have a feature to support removing code at build time? We are providing on premise solution and we would like not to deliver experimental code to clients.
f

future-teacher-7046

04/24/2022, 4:37 PM
We do not. It might be possible to do with environment variables. You could run a nodejs script that pulls features from the GrowthBook API, evaluates all of the features, and writes the values to a .env file. Then you can wrap code in
if(process.env.FEATURE_KEY) {
and your build process should be able to identify dead code and remove it.
👍 2
15 Views