Skip to content

Conversation

blutorange
Copy link

Add documentation for opts.conditions of the resolveRequest function from pnpapi

What's the problem this PR addresses?

Is the conditions option for the resolveRequest function from the pnpapi public? It's currently not documented anywhere.

I came across this as part of visjs/vis-timeline#1898. resolveRequest would not resolve the request properly, complaining that it's not defined in the exports conditions of the package.json.

Then I looked through the .pnpapi.cjs code and found that resolveRequest has a conditions option that defaults to node, require. After setting it to import, it could resolve it successfully.

How did you fix it?

Added documentation.

Checklist

  • I have read the Contributing Guide.

  • I have set the packages that need to be released for my changes to be effective.

  • I will check that all automated PR checks pass before the PR gets reviewed.

Is the `conditions` option for the `resolveRequest` function from the pnpapi public? It's currently not documented anywhere.

I came across this as part of visjs/vis-timeline#1898. `resolveRequest` would not resolve the request properly, complaining that it's not defined in the `exports` conditions of the `package.json`.

Then I looked through the .pnpapi.cjs code and found that `resolveRequest` has a `conditions` option that defaults to `node, require`. After setting it to `import`, it could resolve it successfully.
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.

1 participant