Repository: bokeh/bokeh

Issue:
BokehJS fails to load at all in notebooks after 0.12.7dev12
(bryan) Just clarifying: the issue is that BokehJS no longer works at all in notebooks

----

When moving from bokeh 0.12.7dev11 to 0.12.7dev12, the following code 

   import holoviews as hv
   hv.notebook_extension('bokeh','matplotlib')

goes from working in a notebook to giving the following output:

```
Javascript error adding output!
TypeError: undefined is not an object (evaluating 'Bokeh.set_log_level')
See your browser Javascript console for more details.
```

The JS console shows the following errors:
```
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (preact.min.js.map, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (preact-compat.min.js.map, line 0)
[Error] Failed to load resource: the server responded with a status of 404 (Not Found) (index.js.map, line 0)
```

Holoviews is version 1.8.0.

@mattpap 


Discussion:
Loading just matplotlib does not not produce the error. Loading just Bokeh does produce the error.
@mattpap `window.Bokeh` is never getting defined, my suspicion is that the "webpack" PR is the cause of the problems but I have not verified this with a bisection. 
Here is a gist of the html, js output from `load_notebook` 

https://gist.github.com/bryevdv/d9e29f483f0fc53e59c3028b8842fd86
When this block of code is called:
```
 function run_inline_js() {
    
    if ((window.Bokeh !== undefined) || (force === true)) {
      for (var i = 0; i < inline_js.length; i++) {
        inline_js[i](window.Bokeh);
      }if (force === true) {
        display_loaded();
      }} else if (Date.now() < window._bokeh_timeout) {
      setTimeout(run_inline_js, 100);
    } else if (!window._bokeh_failed_load) {
      console.log("Bokeh: BokehJS failed to load within specified timeout.");
      window._bokeh_failed_load = true;
    } else if (force !== true) {
      var cell = $(document.getElementById("52d65529-68cd-48ea-9c28-99f5596e9182")).parents('.cell').data().cell;
      cell.output_area.append_execute_result(NB_LOAD_WARNING)
    }

  }
```
`window.Bokeh` is undefined at the start, it only proceeds because `force` is true. If you make it false then the load timeout is triggered. 
As an aside until there is some kind of reliable notebook test automation I think we have to institute a policy of adding working notebook screenshots as acceptance documentation to any PR that touches BokehJS. 
Should also add:  I am seeing (and the gist above) is for inline resources, using master. So the load issue affects both CDN and inline usage. 
Working version gist from @hsparra 

https://gist.githubusercontent.com/hsparra/2b6bdd0ee8f12da4a2f182d46d085d1b/raw/5cc88ea026f0b967712ba0e87908aaab91a8cefa/Bokeh_dev11_working.txt

The woking version does this
```
 var inline_js = [
    function(Bokeh) {
      /* BEGIN bokeh.min.js */
      window.Bokeh=Bokeh=function(){var t=void 0;retu
```

The broken version does not set `window.Bokeh` anywhere which is clearly the proximate cause of the problem. @mattpap what is the proper solution here?
In PR #6585 I switched our bundles to use UMD. This has the effect that now, when no module loaders are present, `Bokeh` is defined on implicit `this`, which usually resolves to `window`. This isn't, however, the case in autoload. I will fix this tomorrow.

Resolving patch:
diff --git a/bokeh/util/compiler.py b/bokeh/util/compiler.py
--- a/bokeh/util/compiler.py
+++ b/bokeh/util/compiler.py
@@ -22,15 +22,16 @@
 _plugin_umd = \
 """\
 (function(root, factory) {
-  if(typeof exports === 'object' && typeof module === 'object')
-    factory(require("bokeh"));
-  else if(typeof define === 'function' && define.amd)
-    define(["bokeh"], factory);
-  else if(typeof exports === 'object')
-    factory(require("Bokeh"));
-  else
+//  if(typeof exports === 'object' && typeof module === 'object')
+//    factory(require("Bokeh"));
+//  else if(typeof define === 'function' && define.amd)
+//    define(["Bokeh"], factory);
+//  else if(typeof exports === 'object')
+//    factory(require("Bokeh"));
+//  else
     factory(root["Bokeh"]);
-})(this, function(Bokeh, define /* void 0 */) {
+})(this, function(Bokeh) {
+  var define;
   return %(content)s;
 });
 """


Test patch: