Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hotfix(tree-shaking): skip module delete required dependency in edge #842

Merged

Conversation

stormslowly
Copy link
Member

@stormslowly stormslowly commented Jan 4, 2024

import { c } from './a';
function b(old: boolean = false) {
    const { b } = require('./a');
}

problem

skip ./a 之后,需要删除 module graph 中到 ./a 这条边上的 Dependences 时, 边上有 2 个依赖,一个 ResolveType Import 类型, 一个 Require 类型,source 都是 ./a, 没有指定有可能会误删了 Require 的,导致 ./a 被 tree 掉。

solution

删除时匹配 ResolveType

@stormslowly stormslowly force-pushed the hotfix/skip_module_delete_required_dependecey_in_edge branch from c431926 to f164662 Compare January 4, 2024 08:51
@sorrycc sorrycc merged commit b1b80cf into master Jan 4, 2024
8 checks passed
@delete-merged-branch delete-merged-branch bot deleted the hotfix/skip_module_delete_required_dependecey_in_edge branch January 4, 2024 09:30
@stormslowly stormslowly restored the hotfix/skip_module_delete_required_dependecey_in_edge branch March 25, 2024 05:24
@stormslowly stormslowly deleted the hotfix/skip_module_delete_required_dependecey_in_edge branch August 9, 2024 06:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants