Custom Dashboard in Kibana 4.6.1

I am trying to upgrade Kibana from 4.1.4 to 4.6.1. I have JS file, call it X.js, to customize the Default dashboard.
In 4.1.4, we were loading X.js from kibanaDir/src/public/index.js file using snippet
> $.getScript("manipulate.js", function(){

  console.log('Loaded manipulate script');

});

It was working fine.
Now in 4.6.1, directory structure has been changed a lot. I am trying to load same script from kibanaDir/optimize/bundles/kibana.bundle.js using same code and X.js is in same location. It does not work.

When I tried to debug it using browsers console, the URL to get X.js file was
http://localhost:5601/app/optimize/bundles/X.js, which gave me 404 error. How to do this?
I am very beginner in JS.
Any leads would be appreciated.

I was able to do it with modifying the code as

$.getScript("/bundles/manipulate.js", function(){
console.log('Loaded manipulate script');
});