<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: RequireJS: load a custom script from the /appserver/static in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181442#M11168</link>
    <description>&lt;P&gt;require.js can be a real bear to debug.  The first thing to keep in mind is that there is a core require profile that's in $SPLUNK_HOME/share/splunk/search_mrsparkle/exposed/js/profiles/shared.js.  Relative pathing might be difficult because of this profile.&lt;/P&gt;

&lt;P&gt;Can you share the specific error/errors?  Something about a mismatched anonymous define()?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 16:05:35 GMT</pubDate>
    <dc:creator>araitz</dc:creator>
    <dc:date>2020-09-28T16:05:35Z</dc:date>
    <item>
      <title>RequireJS: load a custom script from the /appserver/static</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181441#M11167</link>
      <description>&lt;P&gt;Hi splunkers,&lt;/P&gt;

&lt;P&gt;One of my SimpleXML dashboards loads a JS script specified within &amp;lt;dashboard&amp;gt; tag. I want this script to load and use another shared .js file. I put them both into /appserver/static and tried to use RequireJS (the first calls "&lt;CODE&gt;define(...)&lt;/CODE&gt;" function, and the second calls "&lt;CODE&gt;require(['./first'], ...)&lt;/CODE&gt;" function). But all I get is a "Script error" in the JS console.&lt;/P&gt;

&lt;P&gt;Is this possible at all? What should I do?&lt;/P&gt;

&lt;P&gt;P.S. I know I can put the shared JS file name into the "script" attribute of the toplevel "dashboard" tag alongside with the main script, but is there any guarantee they'll be loaded sequentially and in the right order?&lt;/P&gt;</description>
      <pubDate>Tue, 11 Mar 2014 11:34:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181441#M11167</guid>
      <dc:creator>npichugin</dc:creator>
      <dc:date>2014-03-11T11:34:38Z</dc:date>
    </item>
    <item>
      <title>Re: RequireJS: load a custom script from the /appserver/static</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181442#M11168</link>
      <description>&lt;P&gt;require.js can be a real bear to debug.  The first thing to keep in mind is that there is a core require profile that's in $SPLUNK_HOME/share/splunk/search_mrsparkle/exposed/js/profiles/shared.js.  Relative pathing might be difficult because of this profile.&lt;/P&gt;

&lt;P&gt;Can you share the specific error/errors?  Something about a mismatched anonymous define()?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 16:05:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181442#M11168</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2020-09-28T16:05:35Z</dc:date>
    </item>
    <item>
      <title>Re: RequireJS: load a custom script from the /appserver/static</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181443#M11169</link>
      <description>&lt;P&gt;Hi araitz,&lt;BR /&gt;
The exact error text I see in a browser console is: &lt;/P&gt;

&lt;P&gt;Error: Script error&lt;BR /&gt;
&lt;A href="http://requirejs.org/docs/errors.html#scripterror"&gt;http://requirejs.org/docs/errors.html#scripterror&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;And this is reported on "config.js:6" -- definitely not my script.&lt;BR /&gt;
The manual page that is referenced by this URL suggests that there may be a syntax error somewhere. I'm not sure if this is the case, though, as I just copy-pasted the 100% working piece of code and wrapped it in a define() call.&lt;BR /&gt;
So, the error message itself is not of great help.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2014 06:58:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181443#M11169</guid>
      <dc:creator>npichugin</dc:creator>
      <dc:date>2014-03-13T06:58:54Z</dc:date>
    </item>
    <item>
      <title>Re: RequireJS: load a custom script from the /appserver/static</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181444#M11170</link>
      <description>&lt;P&gt;That's what I did: I used the Firefox built-in inspector to see what actual scripts are being loaded.&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;&lt;BR /&gt;
GET &lt;A href="http://myhost:8000/en-US/static/@182037/js/first.js"&gt;http://myhost:8000/en-US/static/@182037/js/first.js&lt;/A&gt;&lt;BR /&gt;
GET &lt;A href="http://myhost:8000/en-US/static/@182037:8/app/myapp/second.js"&gt;http://myhost:8000/en-US/static/@182037:8/app/myapp/second.js&lt;/A&gt;&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The first one, of course, fails with 404. So I modified the second.js a bit: changed the "./first" to "../app/myapp/first".&lt;/P&gt;

&lt;P&gt;Now it works, but feels like a fragile hack a bit. I'm not sure if this will work in future versions of Splunk at all. Any suggestions and comments are welcome.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Mar 2014 08:12:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181444#M11170</guid>
      <dc:creator>npichugin</dc:creator>
      <dc:date>2014-03-13T08:12:05Z</dc:date>
    </item>
    <item>
      <title>Re: RequireJS: load a custom script from the /appserver/static</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181445#M11171</link>
      <description>&lt;P&gt;I'm glad you got it to work.  I couldn't agree more: require is hard to configure and debug, and it's hard to feel too confident about those paths staying consistent in the future.  I'll ask the core team what we can do about it.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Mar 2014 17:00:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181445#M11171</guid>
      <dc:creator>araitz</dc:creator>
      <dc:date>2014-03-14T17:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: RequireJS: load a custom script from the /appserver/static</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181446#M11172</link>
      <description>&lt;P&gt;I can but agree. Having the app name in the URL is ugly and calling for future errors that are difficult to diagnose. There should be better support for building custom modules using the mechanism chose by Splunk (RequireJS).&lt;/P&gt;</description>
      <pubDate>Mon, 16 Feb 2015 01:46:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181446#M11172</guid>
      <dc:creator>helge</dc:creator>
      <dc:date>2015-02-16T01:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: RequireJS: load a custom script from the /appserver/static</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181447#M11173</link>
      <description>&lt;P&gt;If You Just want to load two JS files to a simple-XML... &lt;BR /&gt;
Give two script file name separated by comma...&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;script="yourUtil.js,yourPrimary.js"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;yourUtil.js will be loader first and yuorPrimary.js will be loaded...&lt;BR /&gt;
i.e.. in the same order as you define &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Oct 2015 10:35:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/RequireJS-load-a-custom-script-from-the-appserver-static/m-p/181447#M11173</guid>
      <dc:creator>paramagurukarth</dc:creator>
      <dc:date>2015-10-13T10:35:00Z</dc:date>
    </item>
  </channel>
</rss>

