I'm trying to create an app with a setup page, and I'm having issues including two separate JS files that are located under the appserver/static/js
folder in the app.
I haven't been able to add additional JS files apart from the setup_page.js
.
In the setup_page.js
, I have included the files as requireJS demands:
require.options( {
paths: {
myapp: "../app/myapp/js/"
}
});
then:
require([jquery, splunkjs/mvc, "myapp/spinner.js", "myapp/modal.js"]);
However, none of the files modal
or spinner
are loading. I'm getting a RequireJS scripterror, along with a 404, from the Splunk setup page when i try to load the page, which is crashing the JS.
VM138:1903 GET http://10.X.X.X:8000/en-US/static/@e21ee54bc796.107/app/myapp/javascript/spin.js net::ERR_ABORTED 404 (Not Found) setup_page:1
Refused to execute script from 'http://10.X.X.X:8000/en-US/static/@e21ee54bc796.107/app/myapp/javascript/spin.js' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.
I've tried moving around the files, changing names, changing from require.options
to require("myapp/myscript")
etc, to no avail..
Im stumped and don't know how to continue. Please if there are any suggestion, shoot!
I think all you have to do is restart SplunkWeb. The front end won't believe that the file exists unless it sees the file itself during startup. It's a bit silly but it's a very longstanding annoyance.
eg: https://answers.splunk.com/answers/24407/application-js-not-loading.html
I think all you have to do is restart SplunkWeb. The front end won't believe that the file exists unless it sees the file itself during startup. It's a bit silly but it's a very longstanding annoyance.
eg: https://answers.splunk.com/answers/24407/application-js-not-loading.html
Thanks, ended upp doing that and a few other modifications, and it worked. Not sure if the restart was the trick or some other hack, but it works now.