worried-planet-2191
02/16/2023, 9:46 PMswift-helmet-3648
02/17/2023, 2:45 AMconst GrowthBook = require('@growthbook/growthbook').GrowthBook). (Our Node.js section in the docs hints at this.) We don't support ESM imports currently.
If I may ask, do you know what sort of project you intend to use GrowthBook for? Typically our SDK is used with a web server such as Express. You might have a better time trying out GrowthBook by setting up a web server in Node.js first, and then installing GrowthBook onto it.swift-helmet-3648
02/17/2023, 2:47 AMconst GrowthBook = require("@growthbook/growthbook").GrowthBook;
// Create a GrowthBook instance
const gb = new GrowthBook({
apiHost: "<https://cdn.growthbook.io>",
clientKey: "sdk-key",
// Enable easier debugging of feature flags during development
enableDevMode: true,
});
// Wait for features to be available
gb.loadFeatures({ autoRefresh: true }).then(() => {
const color = gb.getFeatureValue("button-color");
console.log("color", color);
});microscopic-refrigerator-66345
02/17/2023, 4:07 AM