Commit a5b5190
fix: handle OS-level absolute paths in module resolver
The module resolver was incorrectly treating OS-level absolute paths (like /Users/...)
as project-relative paths (like /module), causing path duplication when resolving
entry points. This fix distinguishes between the two by checking if the absolute
path has multiple path segments.
The issue occurred because:
1. The resolver checked for absolute paths with fs.existsSync()
2. If the file didn't exist or the check failed, it fell through to the project-relative handler
3. The project-relative handler (resolveAbsolute) would strip the leading '/' and
concatenate with baseUrl, causing duplication
The fix checks if an absolute path has multiple segments (e.g., /Users/foo/bar vs /module)
to determine if it's an OS-level absolute path or a project-relative path.
Fixes the issue where 'somon run hello_world.som' would fail with a duplicated path error.1 parent ed52ef3 commit a5b5190
1 file changed
Lines changed: 13 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
55 | 55 | | |
56 | 56 | | |
57 | 57 | | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
64 | 71 | | |
65 | 72 | | |
66 | 73 | | |
| |||
0 commit comments