<?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: How to delete cached JavaScript files pulled in by require.config in Splunk JS? in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-delete-cached-JavaScript-files-pulled-in-by-require/m-p/487629#M31963</link>
    <description>&lt;P&gt;Does &lt;CODE&gt;splunk restartss&lt;/CODE&gt; work for you from CLI?&lt;/P&gt;</description>
    <pubDate>Wed, 15 Jan 2020 17:44:13 GMT</pubDate>
    <dc:creator>masonmorales</dc:creator>
    <dc:date>2020-01-15T17:44:13Z</dc:date>
    <item>
      <title>How to delete cached JavaScript files pulled in by require.config in Splunk JS?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-delete-cached-JavaScript-files-pulled-in-by-require/m-p/487628#M31962</link>
      <description>&lt;P&gt;In my dashboard, I have passed in some JavaScript which will do some UI rendering, but it first pulls in a compiled React component from the bundle.js file in the require.config path. What I noticed is that the compiled bundle.js seems to get cached somewhere and doesn't get overwritten if I recompile my code to that same named file. It still renders the content from the old bundle.js file. Only when I recompile the React component to a different named file (bundle2.js) and set that in my path, it was able to render the new content. I have tried doing a server reset, server bump, and server refresh, but none of them seem to be removing it. Is there a directory where Splunk saves the files specified in the require.config path and I need to manually delete it from there? As it stands now, I have to rename my bundle.js to something unique every time I make changes to my React component and recompile it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;require.config({
  paths: {
    'react':
      '/static/app/app_name/fast-load/node_modules/react/umd/react.production.min',
    'react-dom':
      '/static/app/app_name/fast-load/node_modules/react-dom/umd/react-dom.production.min',
    'dashboard-container':
      '/static/app/app_name/fast-load/dist/bundle'
  }
});

require(['splunkjs/mvc', 'react', 'react-dom', 'dashboard-container'], function(
  mvc,
  React,
  ReactDOM,
  DashboardContainer
) {
  const search = mvc.Components.get('base1');
  const searchResults = search.data('results', {count: 0, output_mode: 'json'});

  searchResults.on('data', () =&amp;gt; {
    if (searchResults.data()) {
      const FIELDS = ['Name', 'Drilldown', 'range'];
      const serviceList = [];
      const {results} = searchResults.data();

      for (const row of results) {
        const service = {};
        for (const field of FIELDS) {
          service[field] = row[field];
        }
        serviceList.push(service);
      }

      console.log(serviceList);

      ReactDOM.render(
        React.createElement(
          DashboardContainer.default,
          {serviceList: serviceList},
          null
        ),
        document.getElementById('app')
      );
    }
  });
});
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jan 2020 16:55:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-delete-cached-JavaScript-files-pulled-in-by-require/m-p/487628#M31962</guid>
      <dc:creator>ZBhura92</dc:creator>
      <dc:date>2020-01-15T16:55:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to delete cached JavaScript files pulled in by require.config in Splunk JS?</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-delete-cached-JavaScript-files-pulled-in-by-require/m-p/487629#M31963</link>
      <description>&lt;P&gt;Does &lt;CODE&gt;splunk restartss&lt;/CODE&gt; work for you from CLI?&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jan 2020 17:44:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/How-to-delete-cached-JavaScript-files-pulled-in-by-require/m-p/487629#M31963</guid>
      <dc:creator>masonmorales</dc:creator>
      <dc:date>2020-01-15T17:44:13Z</dc:date>
    </item>
  </channel>
</rss>

