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

wonderful-xylophone-6904

06/07/2022, 4:17 PM
Hi GrowthBook team, I'm able to see that my feature is returning "true" in the chrome extension but returns false for -- growthbook.isOn()
Any pointers on what I should be setting or looking for in the growthbook object?
the feature name is "countryfeature"
Actually I found the issue -- has to do with where i've initialized the growthbook object
it's not available globally
f

fresh-football-47124

06/07/2022, 4:55 PM
oh, okay
do you need more help?
w

wonderful-xylophone-6904

06/07/2022, 5:10 PM
Hi Graham
So one thing I do need help with is this -- Im using Drupal CMS and in order to add Javascript to the frontend I need to use "*Custom block library"*
When I use this to insert javascript -- it enters comments after every <script> tag like -
<![CDATA -->
This causes a problem since I'm unable to import the growthbook bundle --
Copy code
<script type="module">
  import { GrowthBook } from "<https://unpkg.com/@growthbook/growthbook/dist/bundles/esm.min.js>";
  //...
</script>
f

fresh-football-47124

06/07/2022, 5:14 PM
@future-teacher-7046
w

wonderful-xylophone-6904

06/07/2022, 5:14 PM
since comments aren't allowed in module type
so I've had to import the entire JS file into the Drupal CMS custom block library
i.e. im copy pasting it and using the classes defined
if you can create a version of the bundle without the "export Growthbook" this will go away
f

future-teacher-7046

06/07/2022, 5:32 PM
There is a version without esm at https://unpkg.com/@growthbook/growthbook/dist/bundles/index.min.js You can add that in a script tag and it stores a global
growthbook.GrowthBook
class in the window
w

wonderful-xylophone-6904

06/07/2022, 5:44 PM
wonderful thanks
you could also update your docs with this info
2 Views