webpack.js.org icon indicating copy to clipboard operation
webpack.js.org copied to clipboard

webpackExports magic comment

Open sokra opened this issue 3 years ago • 1 comments

Feature to document

import(/* webpackExports: "exportName" */ './utils.js') import(/* webpackExports: ["exportNameA", "exportNameB", "default"] */ './utils.js')

Allows to manually pick the exports which should be exposed. Allows to tree shake the others.

Author(s)

@pushkar100

Additional information

Should be listed here:

  • https://webpack.js.org/guides/tree-shaking/
  • https://webpack.js.org/guides/code-splitting/#dynamic-imports

Is already listed here:

  • https://webpack.js.org/api/module-methods/#magic-comments

[ ] I am willing to work on this issue and submit a pull request.

sokra avatar Jan 27 '21 20:01 sokra

Since the code examples in those guides are deeply coupled, it would be almost impossible to incorporate new contents into those guides without drastically changes. We'll see how we can improve the situation.

chenxsan avatar Feb 04 '21 00:02 chenxsan