Skip to content

Commit

Permalink
Stable way to get script path for split bundles (#12191)
Browse files Browse the repository at this point in the history
For #10496
Use a less hacky way to get the path to the scripts to support split bundles.
  • Loading branch information
DonJayamanne authored Jun 8, 2020
1 parent 8328187 commit cf8504f
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 42 deletions.
2 changes: 0 additions & 2 deletions src/client/datascience/notebook/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ export class NotebookOutputRenderer implements VSCNotebookOutputRenderer {
private _preloads: Uri[] = [];
constructor() {
const renderersFolder = path.join(EXTENSION_ROOT_DIR, 'out', 'datascience-ui', 'renderers');
this._preloads.push(Uri.file(path.join(renderersFolder, 'pvscDummy.js')));
this._preloads.push(Uri.file(path.join(renderersFolder, 'main.js')));
this._preloads.push(Uri.file(path.join(renderersFolder, 'renderers.js')));
}

Expand Down
13 changes: 5 additions & 8 deletions src/datascience-ui/renderers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
'use strict';

// This must be on top, do not change. Required by webpack.
// tslint:disable-next-line: no-var-requires no-require-imports
// require('../common/main');
declare let __webpack_public_path__: string;
const getPublicPath = () => {
const currentDirname = (document.currentScript as HTMLScriptElement).src.replace(/[^/]+$/, '');
return new URL(currentDirname).toString();
};

// tslint:disable-next-line: no-any
if ((window as any).__PVSC_Public_Path) {
// This variable tells Webpack to this as the root path used to request webpack bundles.
// tslint:disable-next-line: no-any
__webpack_public_path__ = (window as any).__PVSC_Public_Path;
}
__webpack_public_path__ = getPublicPath();
// This must be on top, do not change. Required by webpack.

import type { nbformat } from '@jupyterlab/coreutils';
Expand Down
26 changes: 0 additions & 26 deletions src/datascience-ui/renderers/main.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/datascience-ui/renderers/pvscDummy.ts

This file was deleted.

0 comments on commit cf8504f

Please sign in to comment.