Skip to content

Fix imports for non-barrel files ending with index #19

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

Merged
merged 2 commits into from
Sep 16, 2017

Conversation

naeramarth7
Copy link
Contributor

The previous replacer removed the trailing index of every import path, no matter if it is a barrel file or just ends in index.

Examples:

# Import from ./_index.ts resolves to:
import { module } from './_';

# import from ./some/path/the-index resolves.ts to:
import { module } from './some/path/the-';

This fix replaces only index if it is a barrel file, so the above examples will be imported correctly while barrel file imports drop the final index from the path.

This resolves buehler/typescript-hero#163.

... fixes buehler/typescript-hero#163
@coveralls
Copy link

coveralls commented Sep 15, 2017

Coverage Status

Coverage increased (+0.09%) to 82.741% when pulling 5eed11d on naeramarth7:bugfix/imports-ending-with-index into 32470ff on TypeScript-Heroes:develop.

@coveralls
Copy link

coveralls commented Sep 15, 2017

Coverage Status

Coverage increased (+0.09%) to 82.741% when pulling 6c5a47a on naeramarth7:bugfix/imports-ending-with-index into 32470ff on TypeScript-Heroes:develop.

@buehler
Copy link
Owner

buehler commented Sep 16, 2017

Thank you!

@buehler buehler merged commit 5c9437a into buehler:develop Sep 16, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants