Skip to content

Rethink about the P'n'P support in napi binding #166

@JounQin

Description

@JounQin

The npm package size of unrs-resolver is significantly larger than oxc-resolver because we enable yarn_pnp feature flag by default: styfle/packagephobia#1074 (comment)

oxc-resolver shows 1.08MB, unrs-resolver shows 3.25MB.

By the way, @rspack/resolver shows 2.83MB

I'm not sure whether we are using any non-native-pnp features(pnpapi) inside, if there is nothing special used, can we just use the pnpapi module instead in the napi binding and disable the yarn_pnp feature flag by default just like oxc-resolver? All I can find is

unrs-resolver/src/lib.rs

Lines 995 to 1002 in b8afa6b

let inner_resolver = self.clone_with_options(self.options().clone());
// try as file or directory `path` in the pnp folder
let Ok(inner_resolution) = inner_resolver.resolve(&path, &inner_request) else {
return Err(ResolveError::NotFound(specifier.to_string()));
};
Ok(Some(self.cache.value(inner_resolution.path())))

cc @arcanis @stormslowly @hardfist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions