summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Greiling <mike@pixelcog.com>2018-03-01 01:47:06 -0600
committerMike Greiling <mike@pixelcog.com>2018-03-01 11:28:34 -0600
commite2c87838157d90062725fd648788c6e1839bc8d8 (patch)
treeda46ab491d608abb9c66ef3b85d5c2a4ff1afff9
parent2d8966f7f521c3d5eae47ff5f1cbc13d37cfc185 (diff)
downloadgitlab-ce-e2c87838157d90062725fd648788c6e1839bc8d8.tar.gz
migrate notebook_viewer to dynamic import
-rw-r--r--app/assets/javascripts/blob/notebook_viewer.js2
-rw-r--r--app/assets/javascripts/blob/viewer/index.js3
-rw-r--r--app/views/projects/blob/viewers/_notebook.html.haml4
-rw-r--r--config/webpack.config.js2
4 files changed, 4 insertions, 7 deletions
diff --git a/app/assets/javascripts/blob/notebook_viewer.js b/app/assets/javascripts/blob/notebook_viewer.js
index b7a0a195a92..226ae69893e 100644
--- a/app/assets/javascripts/blob/notebook_viewer.js
+++ b/app/assets/javascripts/blob/notebook_viewer.js
@@ -1,3 +1,3 @@
import renderNotebook from './notebook';
-document.addEventListener('DOMContentLoaded', renderNotebook);
+export default renderNotebook;
diff --git a/app/assets/javascripts/blob/viewer/index.js b/app/assets/javascripts/blob/viewer/index.js
index 0f1f026dc8b..0574b5b79aa 100644
--- a/app/assets/javascripts/blob/viewer/index.js
+++ b/app/assets/javascripts/blob/viewer/index.js
@@ -32,6 +32,9 @@ export default class BlobViewer {
case 'balsamiq':
initViewer(import(/* webpackChunkName: 'balsamiq_viewer' */ '../balsamiq_viewer'));
break;
+ case 'notebook':
+ initViewer(import(/* webpackChunkName: 'notebook_viewer' */ '../notebook_viewer'));
+ break;
default:
break;
}
diff --git a/app/views/projects/blob/viewers/_notebook.html.haml b/app/views/projects/blob/viewers/_notebook.html.haml
index d1ffaca35b9..eb4ca1b9816 100644
--- a/app/views/projects/blob/viewers/_notebook.html.haml
+++ b/app/views/projects/blob/viewers/_notebook.html.haml
@@ -1,5 +1 @@
-- content_for :page_specific_javascripts do
- = webpack_bundle_tag('common_vue')
- = webpack_bundle_tag('notebook_viewer')
-
.file-content#js-notebook-viewer{ data: { endpoint: blob_raw_path } }
diff --git a/config/webpack.config.js b/config/webpack.config.js
index 2e72e0c335b..20d95ff22a1 100644
--- a/config/webpack.config.js
+++ b/config/webpack.config.js
@@ -45,7 +45,6 @@ function generateEntries() {
const manualEntries = {
monitoring: './monitoring/monitoring_bundle.js',
mr_notes: './mr_notes/index.js',
- notebook_viewer: './blob/notebook_viewer.js',
pdf_viewer: './blob/pdf_viewer.js',
protected_branches: './protected_branches',
registry_list: './registry/index.js',
@@ -225,7 +224,6 @@ const config = {
chunks: [
'monitoring',
'mr_notes',
- 'notebook_viewer',
'pdf_viewer',
'registry_list',
'ide',