Open stormslowly opened 3 months ago
// ==> index.ts <== import { foo } from "./foo"; console.log(foo());
// ==> foo/foo.js <== console.log('foo/foo');
// ==> foo/index.js <== export function foo() { console.log(1); } export function bar() { return require("./foo.js"); }
after tree-shaking, function bar is removed, but there is still a edge to foo/foo.js, so it will be kept in the module graph.
bar
foo/foo.js
expect the foo/foo.js removed from the module graph
after tree-shaking , analyze the shaken ast, to found if the dynamic and cjs-require are still in use.
@goo-yyh 增加一个 foo 在环上的 case,
problem
after tree-shaking, function
bar
is removed, but there is still a edge tofoo/foo.js
, so it will be kept in the module graph.expect the
foo/foo.js
removed from the module graphsolution
after tree-shaking , analyze the shaken ast, to found if the dynamic and cjs-require are still in use.