babel-plugin-wildcard icon indicating copy to clipboard operation
babel-plugin-wildcard copied to clipboard

Proper File Globbing with Recursive Imports

Open RayBenefield opened this issue 6 years ago • 2 comments

PR #10 introduced File Globbing, and shortly afterwards PR #11 introduced Recursive Imports. However the two features do not mesh properly together.

For example:

|- index.js
|- dir
    |- before_a.js
    |- c.js
    |- before_nested
        |- b.js

The following should be possible:

import * as Before from './dir/before_*';

console.log(Before.BeforeA()); // Whatever is in './before_a.js'
console.log(Before.BeforeNested.B()); // Whatever is in './before_nested/b.js'

@drgould does the above look right to you?

RayBenefield avatar Nov 19 '17 19:11 RayBenefield

Yeah, that looks correct.

drgould avatar Nov 20 '17 16:11 drgould

Wouldn't a recursive glob statement look like this?

import * as Before from './dir/**/before_*';

rburnham52 avatar Apr 18 '19 05:04 rburnham52