Skip to content

Commit

Permalink
Success!
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjenkins94 committed Nov 12, 2023
1 parent 6d75165 commit 9933cd9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,14 @@ const importMetaUrlPlugin = {
"entry": {
[baseName]: filePath
},
"external": ["vscode"],
"outDir": assetsDirectory
});

filePath = path.join(assetsDirectory, baseName + ".js");

await fs.writeFile(filePath, (await fs.readFile(filePath, { "encoding": "utf8" })).replace(/^(import .*? from (?:'|")vscode.*?(?:'|");)$/gmu, "//$1"));

await fs.writeFile(filePath, "module.exports.activate = " + (await import(url.pathToFileURL(filePath).toString()))["activate"].toString());
}

Expand Down Expand Up @@ -154,7 +157,7 @@ const importMetaUrlPlugin = {
await fs.copyFile(filePath, path.join(assetsDirectory, baseName));

// So that we can refer to it by its unique name.
return "\"" + (path.relative(importer, filePath).split(/\\|\//gu).length > 2 ? "./assets/" : "./") + baseName + "\"";
return "\"" + (path.relative(importer, filePath).split(/\\+|\//gu).length > 2 ? "./assets/" : "./") + baseName + "\"";
} catch (error) {
// Otherwise, leave it unchanged.
return "\"" + match + "\"";
Expand Down

0 comments on commit 9933cd9

Please sign in to comment.