Skip to content

Commit

Permalink
fix: handling windows path matching failures
Browse files Browse the repository at this point in the history
  • Loading branch information
sh0ckey1 committed Nov 4, 2024
1 parent 11e98e8 commit 5849bf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 5 additions & 1 deletion packages/preset-umi/src/features/check/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@ export default (api: IApi) => {
});

function isAbsolutePath(path: string) {
return path.startsWith('/') || path.startsWith('@fs/');
return (
path.startsWith('/') ||
path.startsWith('@fs/') ||
/^[A-Za-z]:\//.test(path) // fix windows path after transform by winPath method
);
}
};
6 changes: 3 additions & 3 deletions packages/preset-umi/src/features/transform/babelPlugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@ export default function () {
) {
opts.onCheckCode({
args: {
...cache.get(state.opts.filename),
file: state.opts.filename,
isFromTmp: state.opts.filename.startsWith(opts.absTmpPath),
...cache.get(filename),
file: filename,
isFromTmp: filename.startsWith(opts.absTmpPath),
},
});
}
Expand Down

0 comments on commit 5849bf0

Please sign in to comment.