Skip to content

Commit d2c6283

Browse files
msivasubramaniaanvrubezhny
authored andcommitted
Refactor HTML file path resolution in copyHtmlFiles function
1 parent aca3d7f commit d2c6283

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

build/esbuild.webviews.cjs

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ async function copyHtmlFiles() {
9292
await mkdir(targetDir, { recursive: true, mode: 0o750 });
9393
}
9494

95-
const htmlFiles = sync(path.resolve(__dirname, '..', `${srcDir}/webview/${webview}/app/index.html`));
95+
const pattern = path
96+
.join(srcDir, 'webview', webview, 'app', 'index.html')
97+
.replace(/\\/g, '/');
98+
99+
const htmlFiles = sync(pattern, {
100+
cwd: path.resolve(__dirname, '..'),
101+
absolute: true,
102+
});
103+
96104
await Promise.all(
97105
htmlFiles.map(async srcFile => {
98106
await cp(srcFile, path.join(targetDir, path.basename(srcFile)));
@@ -110,10 +118,10 @@ async function dirExists(path) {
110118
}
111119

112120
if (require.main === module) {
113-
buildWebviews().catch(err => {
114-
console.error('❌ Build failed:', err);
115-
process.exit(1);
116-
});
121+
buildWebviews().catch(err => {
122+
console.error('❌ Build failed:', err);
123+
process.exit(1);
124+
});
117125
}
118126

119127
module.exports = { buildWebviews };

0 commit comments

Comments
 (0)