简体   繁体   中英

Does having two exports increase bundle size

If I have the following code

class x {
    ...
}
export CreateFragmentContainer(x,graphqlQuery)

Will the bundle size of my project if I do an another export of class x without the fragmentContainer such as the below?

export class x {
    ...
}
export CreateFragmentContainer(x,graphqlQuery)

Also, will the answer to this question change depending on the framework used?

The bundle size increases only if you import both at the same time, or when you have a default export + named exports, but just use the default export.

What i mean:

export default class {
    ...
}

export const a = '1';

----

Import Something from './myfile'

vs

export default class {
    ...
}

export const a = '1';

----

Import { a } from './myfile'

Method 2 has lower bundle size.

No, it does not depend on the framework, it is a "language feature".

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM