Skip to content

Tree shaking doesn't work with "export * from 'module'" #2847

Description

@Mithras

I'm submitting a bug report

Webpack version:
2.1.0-beta.20

Current behavior:
Tree shaking works with re-exports like "export { something } from 'module'" but doesn't work with "export * from 'module'".

Expected/desired behavior:
Tree shaking works with any kind of re-export.

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem along with a gist/jsbin of your webpack configuration.
app/
    my-feature/
        func12.js
        func34.js
        index.js
    main.js

func12.js

export function func1() { console.log("func1") }
export function func2() { console.log("func2") }

func34.js

export function func3() { console.log("func3") }
export function func4() { console.log("func4") }

index.js

export * from "./func12"
export * from "./func34"

main.js

import { func1, func3 } from "./my-feature"

func1();
func3();
  • What is the expected behavior?
    Only func1() and func3() should be exported.
    func2() and func4() should not, they should be marked as "unused harmony export"

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions