Browse Source

Use frontendUrl from jupyterlab_server: https://github.com/jupyterlab/jupyterlab_server/pull/65

Afshin T. Darian 5 năm trước cách đây
mục cha
commit
83d000e94b

+ 1 - 1
dev_mode/index.js

@@ -9,7 +9,7 @@ import {
   PageConfig, URLExt
 } from '@jupyterlab/coreutils';
 
-__webpack_public_path__ = PageConfig.getOption('bundleUrl');
+__webpack_public_path__ = PageConfig.getOption('frontendUrl');
 
 // This needs to come after __webpack_public_path__ is set.
 require('font-awesome/css/font-awesome.min.css');

+ 3 - 3
dev_mode/webpack.config.js

@@ -90,8 +90,8 @@ JupyterFrontEndPlugin.prototype.apply = function(compiler) {
       var indexPath = path.join(buildDir, 'index.html');
       var indexData = fs.readFileSync(indexPath, 'utf8');
       indexData = indexData
-        .split('{{page_config.bundleUrl}}/')
-        .join('{{page_config.bundleUrl}}');
+        .split('{{page_config.frontendUrl}}/')
+        .join('{{page_config.frontendUrl}}');
       fs.writeFileSync(indexPath, indexData, 'utf8');
 
       // Copy the static assets.
@@ -141,7 +141,7 @@ module.exports = [
     },
     output: {
       path: path.resolve(buildDir),
-      publicPath: '{{page_config.bundleUrl}}',
+      publicPath: '{{page_config.frontendUrl}}',
       filename: '[name].[chunkhash].js'
     },
     optimization: {

+ 1 - 1
examples/app/templates/index.html

@@ -11,7 +11,7 @@
   "baseUrl": "{{base_url}}",
   "wsUrl": "{{ws_url}}"
  }</script>
-  <script src="{{(base_url+page_config['publicUrl'])|replace('//', '/')}}bundle.js" main="index"></script>
+  <script src="{{page_config['frontendUrl']}}bundle.js" main="index"></script>
 
   <script type="text/javascript">
     /* Remove token from URL. */

+ 1 - 1
examples/notebook/main.py

@@ -33,7 +33,7 @@ class ExampleHandler(IPythonHandler):
             'baseUrl': self.base_url,
             'token': self.settings['token'],
             'notebookPath': 'test.ipynb',
-            'bundleUrl': ujoin(self.base_url, 'build/'),
+            'frontendUrl': ujoin(self.base_url, 'build/'),
             # FIXME: Don't use a CDN here
             'mathjaxUrl': "https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.5/MathJax.js",
             'mathjaxConfig': "TeX-AMS_CHTML-full,Safe"

+ 0 - 6
jupyterlab/extension.py

@@ -139,12 +139,6 @@ def load_jupyter_server_extension(nbapp):
     page_config['devMode'] = dev_mode
     page_config['token'] = nbapp.token
 
-    # Handle bundle url
-    bundle_url = config.public_url
-    if bundle_url.startswith(config.page_url):
-        bundle_url = ujoin(base_url, bundle_url)
-    page_config['bundleUrl'] = bundle_url
-
     # Export the version info tuple to a JSON array. This gets printed
     # inside double quote marks, so we render it to a JSON string of the
     # JSON data (so that we can call JSON.parse on the frontend on it).

+ 1 - 1
jupyterlab/staging/index.js

@@ -9,7 +9,7 @@ import {
   PageConfig, URLExt
 } from '@jupyterlab/coreutils';
 
-__webpack_public_path__ = PageConfig.getOption('bundleUrl');
+__webpack_public_path__ = PageConfig.getOption('frontendUrl');
 
 // This needs to come after __webpack_public_path__ is set.
 require('font-awesome/css/font-awesome.min.css');

+ 3 - 3
jupyterlab/staging/webpack.config.js

@@ -90,8 +90,8 @@ JupyterFrontEndPlugin.prototype.apply = function(compiler) {
       var indexPath = path.join(buildDir, 'index.html');
       var indexData = fs.readFileSync(indexPath, 'utf8');
       indexData = indexData
-        .split('{{page_config.bundleUrl}}/')
-        .join('{{page_config.bundleUrl}}');
+        .split('{{page_config.frontendUrl}}/')
+        .join('{{page_config.frontendUrl}}');
       fs.writeFileSync(indexPath, indexData, 'utf8');
 
       // Copy the static assets.
@@ -141,7 +141,7 @@ module.exports = [
     },
     output: {
       path: path.resolve(buildDir),
-      publicPath: '{{page_config.bundleUrl}}',
+      publicPath: '{{page_config.frontendUrl}}',
       filename: '[name].[chunkhash].js'
     },
     optimization: {