title: Tinymce Error - Failed to load plugin js files when dynamically loaded
body: <p>I'm trying to load TinyMCE dynamically like so (on clicking a button):</p>
  
  <pre><code>$.getScript('path/to/mce4/tinymce.min.js', function(){
      var def = {
          selector: 'textarea',
          body_class: 'sp-mce-editor',
          content_css : "path/to/styles/mce.css",
          plugins: ['advlist autolink lists link image charmap print preview hr anchor pagebreak searchreplace wordcount visualblocks visualchars code insertdatetime media nonbreaking table contextmenu directionality emoticons template paste textcolor fullscreen autoresize'],
          toolbar: "bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image | fontsizeselect forecolor backcolor | preview fullscreen | template",
          toolbar_items_size: 'small',
          relative_urls : false,
          convert_urls : true,
          external_plugins: { "nanospell": "path/to/mce4/nanospell/plugin.js" },
          nanospell_server:"php",
          file_browser_callback: RoxyFileBrowser,
          init_instance_callback: (typeof processEditor != 'undefined' ? processEditor : null)
     };
  
  
      tinymce.init(def);
  });
  </code></pre>
  
  <p>With this configuration, tinyMCE fails to initialize. In the console I see several 404 errors, each with a message like this:</p>
  
  <pre><code>Failed to load: /path/to/mce4/plugins/textcolor/plugin.js
  </code></pre>
  
  <p>Sure on checking in the console the JS file <code>tinymce.min.js</code> loads correctly. Also, the <code>/path/to/mce4/plugins/textcolor/plugin.js</code> does not exist. But <code>/path/to/mce4/plugins/textcolor/plugin.min.js</code> exists, and this is true for all the js files involved (i.e. the <code>.min.js</code> files are there, but tinyMCE for whatever reason is looking for the <code>.js</code> files).</p>
  
  <p>Now, when I load tinyMCE in a script tab in the <code>&lt;head&gt;</code>, there's no problem at all, and everything works well.</p>
  
  <p>What could be causing this error, and how am I supposed to fix it? If this is the expected behaviour of tinyMCE, what is the correct way to dynamically load its js file for the scenario such as I am working on?</p>