From 971cb685a7b2538c8e278dff66369cd839a186bd Mon Sep 17 00:00:00 2001 From: Juergen Kunz Date: Fri, 23 Jan 2026 19:12:30 +0000 Subject: [PATCH] fix(mod_output): use pattern base dir when computing relative paths for files to serve --- changelog.md | 6 ++++++ ts/00_commitinfo_data.ts | 2 +- ts/mod_output/index.ts | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index e10f007..1f11e9b 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,11 @@ # Changelog +## 2026-01-23 - 2.8.3 - fix(mod_output) +use pattern base dir when computing relative paths for files to serve + +- Compute relativePath using the pattern base directory (dirPath) instead of this.cwd to ensure correct web-serving paths for absolute or relative entry.path values. +- File changed: ts/mod_output/index.ts — replaces plugins.path.relative(this.cwd, fullPath) with plugins.path.relative(dirPath, fullPath) and adds clarifying comment. + ## 2026-01-23 - 2.8.2 - fix(mod_output) resolve absolute and relative entry.path correctly when adding files diff --git a/ts/00_commitinfo_data.ts b/ts/00_commitinfo_data.ts index 7bf4989..4a5c1d9 100644 --- a/ts/00_commitinfo_data.ts +++ b/ts/00_commitinfo_data.ts @@ -3,6 +3,6 @@ */ export const commitinfo = { name: '@git.zone/tsbundle', - version: '2.8.2', + version: '2.8.3', description: 'a multi-bundler tool supporting esbuild, rolldown, and rspack for painless bundling of web projects' } diff --git a/ts/mod_output/index.ts b/ts/mod_output/index.ts index 28355ee..f311c33 100644 --- a/ts/mod_output/index.ts +++ b/ts/mod_output/index.ts @@ -60,7 +60,8 @@ export class Base64TsOutput { const fullPath = plugins.path.isAbsolute(entry.path) ? entry.path : plugins.path.join(dirPath, entry.path); - const relativePath = plugins.path.relative(this.cwd, fullPath); + // Use path relative to pattern's base dir (not cwd) for web serving + const relativePath = plugins.path.relative(dirPath, fullPath); const content = await plugins.fs.file(fullPath).read(); this.addFile(relativePath, content); }