From 6b6bc19bb18a6f324b3e3000cf5c2308b4e0ef15 Mon Sep 17 00:00:00 2001 From: Josh Barnes Date: Mon, 4 Dec 2017 16:40:04 +0000 Subject: [PATCH] [requirejs] use requirejs over require, no simplified commonjs wrapper * use requirejs over require variable name to avoid confusion on node. See https://github.com/jupyter/notebook/issues/155 for details. * don't use the requirejs simplified commonjs wrapper https://github.com/ipython-contrib/jupyter_contrib_nbextensions/pull/1165 which is slower than a dependency array, and relies on toString parsing. See https://github.com/ipython-contrib/jupyter_contrib_nbextensions/pull/1165 for details. --- main.js | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/main.js b/main.js index 1c6921b..20396d6 100644 --- a/main.js +++ b/main.js @@ -1,11 +1,19 @@ -define(function (require, exports, module) { +define([ + 'jquery', + 'base/js/namespace', + 'base/js/events', + 'base/js/utils', + 'notebook/js/codecell', +], function ( + requirejs, + $, + Jupyter, + events, + utils, + codecell +) { "use strict"; - var $ = require('jquery'); - var Jupyter = require('base/js/namespace'); - var events = require('base/js/events'); - var utils = require('base/js/utils'); - var CodeCell = require('notebook/js/codecell').CodeCell; - + var CodeCell = codecell.CodeCell; var Scratchpad = function (nb) { var scratchpad = this; @@ -124,7 +132,7 @@ define(function (require, exports, module) { var link = document.createElement("link"); link.type = "text/css"; link.rel = "stylesheet"; - link.href = require.toUrl("./scratchpad.css"); + link.href = requirejs.toUrl("./scratchpad.css"); document.getElementsByTagName("head")[0].appendChild(link); // load when the kernel's ready if (Jupyter.notebook.kernel) {