Skip to content

Commit 697be50

Browse files
authored
Merge pull request #3 from ryoppippi/fix-resolve
feat: Add slash to alias and aliasPath
2 parents 325505d + d1eeeeb commit 697be50

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

mod.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,10 @@ async function getAbsPath(
4747
return path.resolve(dirname, file);
4848
}
4949

50-
for (const [_alias, aliasPath] of Object.entries(aliases)) {
51-
const alias = _alias.endsWith("/") ? _alias : `${_alias}/`;
50+
for (const [_alias, _aliasPath] of Object.entries(aliases)) {
51+
const addSlash = (str: string) => (str.endsWith("/") ? str : `${str}/`);
52+
const alias = addSlash(_alias);
53+
const aliasPath = addSlash(_aliasPath);
5254
if (file.startsWith(alias)) {
5355
const s = new MagicString(file);
5456
s.overwrite(0, alias.length, aliasPath);

0 commit comments

Comments
 (0)