MQuy / webpack-deadcode-plugin

Webpack plugin to detect unused files and unused exports in used files
MIT License
348 stars 16 forks source link

Detecting exports used in the same files as unused exports. #40

Closed danielpza closed 2 years ago

danielpza commented 2 years ago

If an export is being used in the same file is being exported the plugin will report it as unused

See reproduction repo: https://github.com/danielpza/webpack-deadcode-plugin-issue-same-file-export/blob/master/src/shared.js

index.js:
  -> imports "shared.js".foo

shared.js
  -- export `foo` uses `sameFileExport`
  -- also exports `sameFileExport` and `unusedExport`
--------------------- Unused Exports ---------------------

/home/daniel/projects/webpack-deadcode-plugin-issue-same-file-export/src/shared.js
    ⟶   sameFileExport, unusedExport

There are 2 unused exports (¬º-°)¬.
MQuy commented 2 years ago

thanks for your bug report @danielpza, it is the plugin limitation at the moment. I wonder will it be better if you don't export sameFileExport?