Skip to content

Commit

Permalink
fix(glob): fs.glob uses native path separator which broke module IDs (#…
Browse files Browse the repository at this point in the history
…283)

We need to ensure that the module IDs use URL-style (aka POSIX-style)
path separators, even on Windows.
  • Loading branch information
dpogue authored Oct 25, 2024
1 parent d05df6e commit 788b62a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion build-tools/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ module.exports = {
return glob(['**/*.js'], { cwd: dir })
.map(fileName => ({
path: path.join(dir, fileName),
moduleId: fileName.slice(0, -3)
// This is used as an identifier with URL-style (POSIX-style) path separators
moduleId: fileName.replaceAll(path.sep, path.posix.sep).slice(0, -3)
}))
.map(file => ({ [file.moduleId]: file }))
.reduce((result, fragment) => Object.assign(result, fragment), {});
Expand Down

0 comments on commit 788b62a

Please sign in to comment.