Skip to content

Commit

Permalink
Refactor extension.ts to use optional chaining for baseUrl
Browse files Browse the repository at this point in the history
  • Loading branch information
uribalb committed Dec 15, 2023
1 parent 0d2e8cd commit 38b2215
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/extension.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,3 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

// Entry point for the notebook bundle containing custom model definitions.
//
// Setup notebook base URL
//
// Some static assets may be required by the custom widget javascript. The base
// url for the notebook is not known at build time and is therefore computed
// dynamically.
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
(window as any).__webpack_public_path__ =
document.querySelector('body')!.getAttribute('data-base-url') +
'nbextensions/ipychess';

const baseUrl = document.querySelector('body')?.getAttribute('data-base-url');
(window as any).__webpack_public_path__ = `${baseUrl}\nnbextensions/ipychess`;
export * from './index';

0 comments on commit 38b2215

Please sign in to comment.