Frontmatter
| id | 9349 |
| title | build: Fix dirent.path resolution and OS-agnostic pathing in esmodules.mjs |
| state | Closed |
| labels | bugwindowsaibuild |
| assignees | tobiu |
| createdAt | Feb 28, 2026, 1:18 PM |
| updatedAt | Feb 28, 2026, 1:19 PM |
| githubUrl | https://github.com/neomjs/neo/issues/9349 |
| author | tobiu |
| commentsCount | 1 |
| parentIssue | null |
| subIssues | [] |
| subIssuesCompleted | 0 |
| subIssuesTotal | 0 |
| contentTrust | |
| projected | |
| quarantined | 0 |
| signals | [] |
| blockedBy | [] |
| blocking | [] |
| closedAt | Feb 28, 2026, 1:19 PM |
build: Fix dirent.path resolution and OS-agnostic pathing in esmodules.mjs

tobiu
Feb 28, 2026, 1:18 PM
Input from Gemini 3.1 Pro:
✦ Fixed the path resolution for Windows and simplified the logic in the latest commit on
dev.
Describe the bug A bug was reported indicating that
dirent.pathis problematic on Windows within@buildScripts/build/esmodules.mjs.Cause In older versions of Node.js or in specific environments,
fs.Direntobjects might not uniformly expose.path(they sometimes useparentPathor missing it completely). Furthermore, relying on exact directory name matching viaif (dirent.name === 'resources')combined with nested manual traversals creates brittle path resolutions when dealing with cross-platform slashes (e.g.\vs/).Solution
const currentPath = dirent.parentPath || dirent.path;/so string matching is OS-agnostic:.replace(/\\/g, '/').minifyDirectoryto evaluate file-by-file recursively rather than doing an awkward combination of file reading and directory copying inside a single conditional block. This removes the need to parse theoutputPathto find JSON files within a copied directory.ServiceWorker.mjsif it actually exists in the root directory.