In theory, it does not. In practice, it may affect the tree shaking.
In theory, it should not impact because bundler should be able to find the usage patterns and do the tree shaking.
But in practice, there are two challenges. The first one is the problem of call site, e.g.:
import { resultOfSomeCalculation } from './other.js';
import * as all from './all.js';
const key = resultOfSomeCalculation();
export function getData() {
return all[key]();
}
In this example, the bundle cannot figure out statically i.e. at compile time which function will be called and thus it ends up bundling everything together.
The second challenge is the implementation of the bundler itself. When you have multiple nested namespaced imports coupled with barrel exports, it quickly spirals out of hands. There are so many edge cases. It works for simpler cases but not for these deeply nested imports.
Thus, there are limitations to tree shaking with namespaced imports. And on a side note, do not avoid namespaced imports just for the sake of tree shaking. Tree shaking is optimization goal and not the end result. If it makes code readable, feel free to use namespace imports.