-
Notifications
You must be signed in to change notification settings - Fork 920
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix alias match function #890
Conversation
This pull request is being automatically deployed with Vercel (learn more). 🔍 Inspect: https://vercel.com/pikapkg/snowpack/r5pugzmcl |
2becadc
to
ed3d3fc
Compare
ed3d3fc
to
7214e97
Compare
7214e97
to
6c7d507
Compare
6c7d507
to
461d94f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome improvement. Thank you!
@@ -261,6 +261,8 @@ export function findMatchingAliasEntry( | |||
): {from: string; to: string; type: 'package' | 'path'} | undefined { | |||
// Only match bare module specifiers. relative and absolute imports should not match | |||
if ( | |||
spec === '.' || | |||
spec === '..' || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ha! is this supported in the browser? I'm not sure if I've ever used this myself, but I guess this is a valid path?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a case that is using import * from '.';
in utils/a.js to import some other function.
return undefined; | ||
|
||
for (const [from, to] of Object.entries(config.alias)) { | ||
let foundType: 'package' | 'path' | '' = ''; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
/cc @drwpow '' = ''
as a type seems fishy, I would have liked to have cleaned this up a bit before merging. Will create a quick PR to follow up.
Changes
alias: { "@": "." }
andalias: { "@": ".." }
Testing
Test added