<?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: require(['splunkjs/mvc'], function() { ... } gives me &amp;quot;require is not defined&amp;quot; Javascript error (SE 9.1.1) in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/require-splunkjs-mvc-function-gives-me-quot-require-is-not/m-p/660295#M111658</link>
    <description>&lt;P&gt;Without knowing more about your javascript, is there something happening where you are doing a &lt;EM&gt;require&lt;/EM&gt; of a module that should be included with an &lt;EM&gt;import&lt;/EM&gt;?&amp;nbsp; Or, you might need to load abcxyz.js in a different way because of the contents.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/70067056/how-to-require-js-file-in-a-src-file-inside-script" target="_self"&gt;This answer over on StackOverflow&lt;/A&gt; addresses the more generic javascript quirkiness you could be running into.&lt;/P&gt;</description>
    <pubDate>Tue, 10 Oct 2023 20:01:23 GMT</pubDate>
    <dc:creator>_JP</dc:creator>
    <dc:date>2023-10-10T20:01:23Z</dc:date>
    <item>
      <title>require(['splunkjs/mvc'], function() { ... } gives me "require is not defined" Javascript error (SE 9.1.1)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/require-splunkjs-mvc-function-gives-me-quot-require-is-not/m-p/660287#M111655</link>
      <description>&lt;P&gt;In a modified&amp;nbsp; &lt;STRONG&gt;search_mrsparkle/templates/pages/base.html&lt;/STRONG&gt;, we have a &amp;lt;script&amp;gt; tag inserted just before the &amp;lt;/body&amp;gt; tag, as follows:&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;&amp;lt;script src="${make_url('/static/js/abcxyz.js')}"&amp;gt;&amp;lt;/script&amp;gt;&lt;/STRONG&gt;&amp;lt;/body&amp;gt;&lt;BR /&gt;&lt;BR /&gt;with &lt;STRONG&gt;abcxyz.js&lt;/STRONG&gt; placed in the &lt;STRONG&gt;search_mrsparkle/exposed/js&lt;/STRONG&gt; directory.&lt;BR /&gt;&lt;BR /&gt;The &lt;STRONG&gt;abcxyz.js&lt;/STRONG&gt; file has the following code:&amp;nbsp;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;&lt;STRONG&gt;require(['splunkjs/mvc'], function(mvc) { ... }&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;which performs some magical stuff on the web page.&amp;nbsp; But when the page loads, the debugging console reports "&lt;STRONG&gt;require is not defined&lt;/STRONG&gt;".&amp;nbsp; This used to work under SE 9.0.0.1 (and earlier) but now fails under SE 9.1.1.&lt;/P&gt;&lt;P&gt;Yes, we realize we are modifying Splunk-delivered code, but we have requirements that required us taking these drastic actions.&lt;/P&gt;&lt;P&gt;Anyone have any ideas on how to remedy this issue?&lt;/P&gt;&lt;P&gt;---------------------------------------------------------------------------&lt;BR /&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/30089"&gt;@mhoustonludlam_&lt;/a&gt;&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/242022"&gt;@C_Mooney&lt;/a&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 19:23:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/require-splunkjs-mvc-function-gives-me-quot-require-is-not/m-p/660287#M111655</guid>
      <dc:creator>joemcmahon</dc:creator>
      <dc:date>2023-10-10T19:23:48Z</dc:date>
    </item>
    <item>
      <title>Re: require(['splunkjs/mvc'], function() { ... } gives me "require is not defined" Javascript error (SE 9.1.1)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/require-splunkjs-mvc-function-gives-me-quot-require-is-not/m-p/660295#M111658</link>
      <description>&lt;P&gt;Without knowing more about your javascript, is there something happening where you are doing a &lt;EM&gt;require&lt;/EM&gt; of a module that should be included with an &lt;EM&gt;import&lt;/EM&gt;?&amp;nbsp; Or, you might need to load abcxyz.js in a different way because of the contents.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="https://stackoverflow.com/questions/70067056/how-to-require-js-file-in-a-src-file-inside-script" target="_self"&gt;This answer over on StackOverflow&lt;/A&gt; addresses the more generic javascript quirkiness you could be running into.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Oct 2023 20:01:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/require-splunkjs-mvc-function-gives-me-quot-require-is-not/m-p/660295#M111658</guid>
      <dc:creator>_JP</dc:creator>
      <dc:date>2023-10-10T20:01:23Z</dc:date>
    </item>
    <item>
      <title>Re: require(['splunkjs/mvc'], function() { ... } gives me "require is not defined" Javascript error (SE 9.1.1)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/require-splunkjs-mvc-function-gives-me-quot-require-is-not/m-p/660566#M111672</link>
      <description>&lt;P&gt;So, I found a "fix" or "workaround" that I'm not too happy about, but it seems to solve the issue.&lt;/P&gt;&lt;P&gt;Surrounding the "require" with a 5 second "setTimeout" call, seems to work fine, as follows:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;setTimeout(function()&amp;nbsp; {&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;&amp;nbsp; &amp;nbsp; require(['splunkjs/mvc'], function(mvc) { ... }&lt;BR /&gt;&lt;/STRONG&gt;&lt;STRONG&gt;}, 5000);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;If anyone can shed any light on this "issue", please advise.&lt;/P&gt;</description>
      <pubDate>Thu, 12 Oct 2023 17:21:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/require-splunkjs-mvc-function-gives-me-quot-require-is-not/m-p/660566#M111672</guid>
      <dc:creator>joemcmahon</dc:creator>
      <dc:date>2023-10-12T17:21:08Z</dc:date>
    </item>
  </channel>
</rss>

