Skip to content

remove unused modules if they have sideEffects: false #28

@goto-bus-stop

Description

@goto-bus-stop

Following from #17, although we can't remove unused modules in the general case, if something does

var _ = require('lodash')
exports.a = function () { /* something not using lodash */ }
exports.b = function (x) { _.map(x, /* etc */) }

and you're not using exports.b, exports.b will be dropped, lodash becomes unused, and we can check the lodash package.json file to see that it is safe to remove the require() call.

So this is intended to address the case where all uses of a module have been shaken out, not for the case where it's not used in the first place—then it might be a polyfill or something.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions