knip
knip copied to clipboard
💡 Automatically pick up `resolve.alias` in webpack
Suggest an idea for Knip
I have this configuration in my webpack.config.js:
alias: {
// Not needed in this build
handlebars: false,
// https://github.com/webpack/webpack/pull/12693#issuecomment-914079083
filenamify: "filenamify/browser",
// Silently improve tree-shakeability and AMD-related errors
lodash: "lodash-es",
// Lighter jQuery version
jquery: "jquery/dist/jquery.slim.min.js",
},
In which every lodash import is mapped to lodash-es. This doesn't seem to be picked up by knip, which requires either ignoreDependencies or paths: https://knip.dev/reference/configuration#paths
Can this field be automatically picked up instead? Both for local aliases and node_module aliases
If you (or someone else) could think of a solution, pull requests to add this are welcome.
Knip v5.54.0 respects resolve.alias (by translating them to compilerOptions.paths, but does not do the mapping/swapping thing.
So I'm going to close this one, we can keep #950 open for that RFC.