Skip to content
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

Importing created subdirectory index files #44

Open
yoiang opened this issue Feb 15, 2018 · 5 comments
Open

Importing created subdirectory index files #44

yoiang opened this issue Feb 15, 2018 · 5 comments

Comments

@yoiang
Copy link

yoiang commented Feb 15, 2018

Hello! Thanks so much for the great work on create-index! I apologize if this has been brought up before, after some time of searching the issues and pull requests I could not find mention of it.

I have a library project with some deeper source folders and much to my delight create-index does indeed create index.js files exactly how I was looking for, short of one thing. When creating a parent folder's index.js and using the recurse into subfolders option the parent folder's index.js will not import the child folder's. To further call the inconsistency out, subsequent runs of create-index will properly import the child folder's now created index.js.

I'd be happy to submit a PR if this seems like a feature that should be included, especially if it's something someone unfamiliar with the source can easily jump in and do, say if it's a matter of swapping the order of generation.

Thank you for your time!

@anpleenko
Copy link

+1

@SharpSeeEr
Copy link

I have this issue as well, but I find the parent folder index.js imports the child folder the same as if it were a file, which is giving me errors:

export { default as dirname } from './dirname';

I believe (and could definitely be wrong) it should import the directory like this (and this works in my projects):

import * as dirname from './dirname';

export { dirname };

@yoiang - Is this similar to your issue/findings?

@yoiang
Copy link
Author

yoiang commented Mar 6, 2019

@SharpSeeEr I don't recall, it's been a while. Sorry~!

@wjramos
Copy link

wjramos commented Nov 4, 2019

I am seeing the same issue, create-index does not handle named exports at all

@ChocolateLoverRaj
Copy link

@SharpSeeEr There is an even better way:

export * as dirNamedExports from './dir'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants