Home > database >  how to export an imported package
how to export an imported package

Time:11-10

Say for file1 I have

import * as Things1 from "../things1"
import * as Things2 from "../things2"

export {
    Things1,
    Things2,
}

and for file2 I have

import * as Distributor from "../file1"
import * as Things3 from "../../things3"

How do I export it so it looks like

export {
    Things1,
    Things2,
    Things3,
}

in file2?

I don't want to use

export const Things1 = Distributor.Things1;

because there are quite a few variables beings exported in my actual file

CodePudding user response:

You can export everything directly like this:

export * from "../file1"; // export everything from file1
export { Things3 } from "../../thing3"; // selectively export only Things3
  • Related