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

Additional features #9

Open
serhiipalash opened this issue Aug 18, 2017 · 3 comments
Open

Additional features #9

serhiipalash opened this issue Aug 18, 2017 · 3 comments

Comments

@serhiipalash
Copy link

Hello!
Very nice plugin!
Can you add more functionality to it?

  1. Possibility to import nested folder's index.js by folder name.
    I have such a project structure
/components
   /Button
      index.js
      style.css
   /Header
      index.js
      style.css

Is it possible to import components like this?

import { Button, Header } from './components/*'
  1. Possibility to import nested folder's directory named file by folder name like Webpack DirectoryNamedWebpackPlugin does
    There is an implementation of it for Babel, but it is not supported any more. Not published on npmjs mdluo/babel-plugin-directory-named-module#1

It would be great to get rid of index.js all over my React Native project.
Thanks in advance for your help!

@RayBenefield
Copy link

I've actually started working on the first one, the nested folder structure system, this morning. :) It will be my first public open source pull request. I've got the initial use case setup, but I'm working on making sure it is fully recursive so I'm working on the importing multiple files deeply now and I still need to figure out the best way to handle index.js (I may save this for another go Pull Request later). This is also my first time working on a babel plugin.

https://github.com/RayBenefield/babel-plugin-wildcard/tree/Recursive-Imports

Still working on it and hopefully I'll get it done in the next day or two as I need it for a project I'm working on too.

As for the second one, that looks interesting, for me that feels out of scope for this plugin as it isn't really a "wildcard" thing.

@serhiipalash
Copy link
Author

I've actually started working on the first one

Great! Good luck!

@RayBenefield
Copy link

I've put in the initial pull request for the first portion (#11). However it doesn't solve your use case @serhiipalash . It doesn't specially handle index.js and I haven't quite figured out filtering yet. Right now it just handles:

|- index.js
|- dir
    |- a.js
    |- c.js
    |- nested
        |- b.js

the allowing JS:

import * as Items from './dir';
console.log(Items.Nested.B());

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

No branches or pull requests

2 participants