Skip to content

commonjs tree shaking not work in webpack5 #14054

@ishowman

Description

@ishowman

Bug report

What is the current behavior?
all the methods defined in commonjs module will be include in dist file

If the current behavior is a bug, please provide the steps to reproduce.

This is the repo for reproduce。

What is the expected behavior?
only include used methods in my commonjs module

Other relevant information:
webpack version:

  • "webpack": "^5.51.1",
  • "webpack-cli": "^4.8.0"
    Node.js version: v12.14.0
    Operating System: Win 10
    Additional tools: null

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions