360d7b3 added basic tree-shaking functionality. However, as implemented, modules that come away completely unused (and their dependencies) are still included in the module bundles.
Edit: Took a simpler approach to this:
- Detect all ES^
imports/exports for all modules.
- Go through all modules and mark any imports as used.
- For any unused exports, transform
exports.foo = foo... into foo... so that it can be removed by a minifier.
This succeeds in removing unused exports from modules. However, this doesn't help determine which sub-dependencies are no longer needed. Need to take another pass at this to come up with a clever way to detect and remove the unused modules from the build.
360d7b3 added basic tree-shaking functionality. However, as implemented, modules that come away completely unused (and their dependencies) are still included in the module bundles.
detect which modules exclusively use ES6 exportsfor all other modules (which aren't removed, or which use non-ES6 exports), track its dependencies and mark these to keepEdit: Took a simpler approach to this:
imports/exports for all modules.exports.foo = foo...intofoo...so that it can be removed by a minifier.This succeeds in removing unused exports from modules. However, this doesn't help determine which sub-dependencies are no longer needed. Need to take another pass at this to come up with a clever way to detect and remove the unused modules from the build.