Discourse.SiteSettings がプラグイン初期化コードで未定義

When I attempt to do something like the following:

if (!Discourse.SiteSetting.my_plugin_enabled) {
    // code here
}

My page won’t load & I get an error in the dev console saying Cannot read property 'my_plugin_enabled' of undefined.


My plugin.rb includes enabled_site_setting :my_plugin_enabled, and my settings.yml includes my_plugin_enabled set to true for default & the client

You can access the SiteSetting object like this:

https://github.com/discourse/discourse-voting/blob/main/assets/javascripts/discourse/initializers/discourse-voting.js.es6#L11

「いいね!」 4

Thank you very much!