Skip to content

fix(v2): Use require.resolve to resolve plugin path in presets - #2794

Merged
yangshun merged 1 commit into
meta:masterfrom
SamChou19815:preset-require-resolve-plugin
May 22, 2020
Merged

yangshun merged 1 commit into
meta:masterfrom
SamChou19815:preset-require-resolve-plugin

Conversation

@SamChou19815

Copy link
Copy Markdown
Contributor

Motivation

This diff continues the progress of making docusaurus v2 work under yarn v2's pnp mode.

It would almost resolve almost all module resolution issues with yarn v2 pnp, except for presets. Docusaurus's presets still use plain string to refer to modules, which will make pnp module resolution fail.

In this diff, I fixed all the presets to use require.resolve in this repo. I also updated the docs to educate preset writers to use require.resolve in their code.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

Everything can still be properly loaded, and the preview site still works.

Related PRs

(If this PR adds or changes functionality, please take some time to update the docs at https://github.com/facebook/docusaurus, and link to your PR here.)

@SamChou19815 SamChou19815 changed the title Use require.resolve to resolve plugin path in presets fix(v2): Use require.resolve to resolve plugin path in presets May 22, 2020
@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 22, 2020
@docusaurus-bot

Copy link
Copy Markdown
Contributor

@SamChou19815
SamChou19815 marked this pull request as ready for review May 22, 2020 19:10
@SamChou19815
SamChou19815 requested a review from yangshun as a code owner May 22, 2020 19:10
@docusaurus-bot

Copy link
Copy Markdown
Contributor

@yangshun yangshun left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

@yangshun
yangshun merged commit 1503943 into meta:master May 22, 2020
@SamChou19815
SamChou19815 deleted the preset-require-resolve-plugin branch May 22, 2020 20:59
@lex111 lex111 added this to the v2.0.0-alpha.56 milestone May 27, 2020
mrizwanashiq pushed a commit to mrizwanashiq/docusaurus that referenced this pull request Jun 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed Signed Facebook CLA

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants