Skip to content

Commit 7666eb1

Browse files
committed
Embed the scripts in the html template
1 parent 51a6d22 commit 7666eb1

File tree

1 file changed

+4
-12
lines changed

1 file changed

+4
-12
lines changed

editors/code/src/commands.ts

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -485,17 +485,7 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
485485
};
486486

487487
const dot = await ctx.client.sendRequest(ra.viewCrateGraph, params);
488-
489-
const scripts = [
490-
{ file: '/d3/dist/d3.min.js' },
491-
{ file: '/@hpcc-js/wasm/dist/index.min.js', worker: true },
492-
{ file: '/d3-graphviz/build/d3-graphviz.min.js' },
493-
];
494-
495-
const scriptsHtml = scripts.map(({ file, worker }) => {
496-
const uri = panel.webview.asWebviewUri(vscode.Uri.joinPath(nodeModulesPath, file));
497-
return `<script type="${worker ? "javascript/worker" : "text/javascript"}" src="${uri}"></script>`;
498-
}).join("\n");
488+
const uri = panel.webview.asWebviewUri(nodeModulesPath);
499489

500490
const html = `
501491
<!DOCTYPE html>
@@ -515,7 +505,9 @@ function crateGraph(ctx: Ctx, full: boolean): Cmd {
515505
</style>
516506
</head>
517507
<body>
518-
${scriptsHtml}
508+
<script type="text/javascript" src="${uri}/d3/dist/d3.min.js"></script>
509+
<script type="javascript/worker" src="${uri}/@hpcc-js/wasm/dist/index.min.js"></script>
510+
<script type="text/javascript" src="${uri}/d3-graphviz/build/d3-graphviz.min.js"></script>
519511
<div id="graph"></div>
520512
<script>
521513
let graph = d3.select("#graph")

0 commit comments

Comments
 (0)