Skip to content

Commit

Permalink
Apply an ugly patch for require config, needed for notebook 5.1
Browse files Browse the repository at this point in the history
it got broken by jupyter/notebook#2140
  • Loading branch information
jcb91 committed Oct 1, 2017
1 parent d722470 commit 74615ad
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,34 @@
{% block script %}

{{super()}}

<script type="text/javascript">
sys_info = {{sys_info|safe}};
</script>

<script type="text/javascript" charset="utf-8">
// some ugly hacks to fix notebook 5.1.0's broken require config, as
// introduced by https://github.com/jupyter/notebook/pull/2140
(function () {
var nb_v_arr = sys_info.notebook_version.split('.');
if (Number(nb_v_arr[0]) == 5 && Number(nb_v_arr[1]) > 0) {
console.log(
'[nbextensions_configurator] patching requirejs config for notebook',
sys_info.notebook_version);
require.config({paths: {
jed: 'components/jed/jed',
json: 'components/requirejs-plugins/src/json',
text: 'components/requirejs-text/text',
moment: 'components/moment/min/moment-with-locales'
}});
if (!require.defined('json!base/../../i18n/nbjs.json')) {
define('json!base/../../i18n/nbjs.json', function() { return {
"domain": "nbjs",
"supported_languages": [],
"locale_data": {"nbjs": {"": {"domain": "nbjs"}}}
}; });
}
}
})(); // end ugly nb 5.1 hacks IIFE
require(['jquery'], function (jq) {
// hack to fix notebook 4.2.1
// see https://github.com/jupyter/notebook/pull/1399
Expand Down

0 comments on commit 74615ad

Please sign in to comment.