Damien Leroux
Damien Leroux

Reputation: 11693

reexport and flatten both the default & named exports using es6 syntax

A folder folder has several js files. one of them, var.js exports default & name variable at the same times:

export a ...
export b ...
export default c ...

I can then write: import c,{a,b} from "folder/var";

In folder, I want to write index.js to reexport variables from var.js and be able to write:

import {c,a,b} from "folder";:

I wrote in index.js:

export * from "./var"

From what I understand from exploringjs.com section 16.4.4 All exporting styles, It will export only a and b from var.js. How can I "flatten" export from var.js in index.js?

Upvotes: 3

Views: 819

Answers (1)

a better oliver
a better oliver

Reputation: 26828

I'm not sure I understand your question correctly, but you can do the following:

export {a,b, default as c} from "./var";

Upvotes: 2

Related Questions