indexr icon indicating copy to clipboard operation
indexr copied to clipboard

Export named object

Open tjoskar opened this issue 9 years ago • 1 comments
trafficstars

Hi,

Nice project!

I have however a question; I usually name my export like following:

// test.js
export function foo() {
    return 'foo';
}

export function foo() {
    return 'bar';
}

But when I use indexr, it will create the following content (indexr -m "." --submodules "test.js" . --named-exports):

export { default as testJs } from './test.js';

Which will not work :/ If indexr, however, created the following file:

export * from './test.js';

everything would work perfectly. Is it possible to add an extra flag to just export everything (star export as shown above)?

tjoskar avatar Sep 06 '16 17:09 tjoskar

hmm this is a reasonable request and is easy to do however this kind of thing opens up a floodgate of other possibilities (ie. take the exports called 'foo' and put them in an index called 'foo.js') which might be better configured more flexibly using comment annotations or global config which would deprecate all flags (probably a good thing). I need to think about how best to do this.

ryardley avatar Sep 07 '16 01:09 ryardley