From 1ebdcee547729461a3b0bf04a77ff30ad0b774b3 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Sat, 21 Nov 2020 10:11:03 -0500 Subject: [PATCH 1/6] add lazy loading --- {{cookiecutter.github_project_name}}/src/plugin.ts | 4 +--- {{cookiecutter.github_project_name}}/tsconfig.json | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/{{cookiecutter.github_project_name}}/src/plugin.ts b/{{cookiecutter.github_project_name}}/src/plugin.ts index 900c125..61f25f6 100644 --- a/{{cookiecutter.github_project_name}}/src/plugin.ts +++ b/{{cookiecutter.github_project_name}}/src/plugin.ts @@ -7,8 +7,6 @@ import { Widget } from '@phosphor/widgets'; import { IJupyterWidgetRegistry } from '@jupyter-widgets/base'; -import * as widgetExports from './widget'; - import { MODULE_NAME, MODULE_VERSION } from './version'; const EXTENSION_ID = '{{ cookiecutter.npm_package_name }}:plugin'; @@ -37,6 +35,6 @@ function activateWidgetExtension( registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, - exports: widgetExports, + exports: async () => import(/* webpackChunkName: "{{ cookiecutter.npm_package_name }}" */ './widget'), }); } diff --git a/{{cookiecutter.github_project_name}}/tsconfig.json b/{{cookiecutter.github_project_name}}/tsconfig.json index f143a55..286559e 100644 --- a/{{cookiecutter.github_project_name}}/tsconfig.json +++ b/{{cookiecutter.github_project_name}}/tsconfig.json @@ -3,7 +3,7 @@ "declaration": true, "esModuleInterop":true, "lib": ["es2015", "dom"], - "module": "commonjs", + "module": "esnext", "moduleResolution": "node", "noEmitOnError": true, "noUnusedLocals": true, From 138ea68e921859a38ffc9d0ce90f5c3b74ef8d5f Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Sat, 21 Nov 2020 14:06:31 -0500 Subject: [PATCH 2/6] fix lint --- {{cookiecutter.github_project_name}}/src/plugin.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/{{cookiecutter.github_project_name}}/src/plugin.ts b/{{cookiecutter.github_project_name}}/src/plugin.ts index 61f25f6..af04bcc 100644 --- a/{{cookiecutter.github_project_name}}/src/plugin.ts +++ b/{{cookiecutter.github_project_name}}/src/plugin.ts @@ -35,6 +35,9 @@ function activateWidgetExtension( registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, - exports: async () => import(/* webpackChunkName: "{{ cookiecutter.npm_package_name }}" */ './widget'), + exports: async () => import( + /* webpackChunkName: "{{ cookiecutter.npm_package_name }}" */ + './widget' + ), }); } From c8f5514be3fdd6584289dcca735ca4b173473477 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Wed, 17 Mar 2021 08:08:49 -0400 Subject: [PATCH 3/6] Update {{cookiecutter.github_project_name}}/src/plugin.ts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Frédéric Collonval --- {{cookiecutter.github_project_name}}/src/plugin.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/{{cookiecutter.github_project_name}}/src/plugin.ts b/{{cookiecutter.github_project_name}}/src/plugin.ts index af04bcc..06bc02e 100644 --- a/{{cookiecutter.github_project_name}}/src/plugin.ts +++ b/{{cookiecutter.github_project_name}}/src/plugin.ts @@ -36,7 +36,7 @@ function activateWidgetExtension( name: MODULE_NAME, version: MODULE_VERSION, exports: async () => import( - /* webpackChunkName: "{{ cookiecutter.npm_package_name }}" */ + /* webpackChunkName: "{{ cookiecutter.npm_package_name }}-widgets" */ './widget' ), }); From dd70c7089c8f1e2cf2ad9748e3a86792e06161cb Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Wed, 17 Mar 2021 08:25:06 -0400 Subject: [PATCH 4/6] lint --- {{cookiecutter.github_project_name}}/src/plugin.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/{{cookiecutter.github_project_name}}/src/plugin.ts b/{{cookiecutter.github_project_name}}/src/plugin.ts index 06bc02e..09564dd 100644 --- a/{{cookiecutter.github_project_name}}/src/plugin.ts +++ b/{{cookiecutter.github_project_name}}/src/plugin.ts @@ -35,9 +35,10 @@ function activateWidgetExtension( registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, - exports: async () => import( - /* webpackChunkName: "{{ cookiecutter.npm_package_name }}-widgets" */ - './widget' - ), + exports: async () => + import( + /* webpackChunkName: "{{ cookiecutter.npm_package_name }}-widgets" */ + './widget' + ), }); } From 6f507d77ecd117184a36d176205dbcc86f7ed868 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Wed, 17 Mar 2021 08:34:22 -0400 Subject: [PATCH 5/6] lint --- {{cookiecutter.github_project_name}}/src/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/{{cookiecutter.github_project_name}}/src/plugin.ts b/{{cookiecutter.github_project_name}}/src/plugin.ts index 09564dd..de62ee5 100644 --- a/{{cookiecutter.github_project_name}}/src/plugin.ts +++ b/{{cookiecutter.github_project_name}}/src/plugin.ts @@ -37,8 +37,8 @@ function activateWidgetExtension( version: MODULE_VERSION, exports: async () => import( - /* webpackChunkName: "{{ cookiecutter.npm_package_name }}-widgets" */ + /* webpackChunkName: "{{ cookiecutter.npm_package_name }}-widgets" */ './widget' - ), + ) }); } From 5ace0eb26f74d7724b4eefa672a7f36399218003 Mon Sep 17 00:00:00 2001 From: Nicholas Bollweg Date: Wed, 17 Mar 2021 19:56:32 -0400 Subject: [PATCH 6/6] remove vanity chunk name and async, rely on returning the promise --- {{cookiecutter.github_project_name}}/src/plugin.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/{{cookiecutter.github_project_name}}/src/plugin.ts b/{{cookiecutter.github_project_name}}/src/plugin.ts index de62ee5..b75f43c 100644 --- a/{{cookiecutter.github_project_name}}/src/plugin.ts +++ b/{{cookiecutter.github_project_name}}/src/plugin.ts @@ -35,10 +35,6 @@ function activateWidgetExtension( registry.registerWidget({ name: MODULE_NAME, version: MODULE_VERSION, - exports: async () => - import( - /* webpackChunkName: "{{ cookiecutter.npm_package_name }}-widgets" */ - './widget' - ) + exports: () => import('./widget'), }); }