'Different export type in JavaScript

Is it possible in JavaScript to do something like: export * from '*/**'?

Expect to export all modules from the entry point (index.js) like:

export * from '*/**.js'

Instead of:

export * from './thing.js'
export * from './something/something.js`


Solution 1:[1]

export const doSomething = () => {}
export const doSomethingElse = () => {}

or in an index.js file like

export * from './bar';

It's done like above and then you use the functions in bar like this:

import * as foo from '../foo/bar';

foo.doSomething();

If you only want doSomething() then this should work:

import { doSomething } from '../foo/bar';

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1