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

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

Merged
merged 1 commit into from
May 22, 2020
Merged

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

merged 1 commit into from
May 22, 2020

Conversation

SamChou19815
Copy link
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
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit 62834d3

https://deploy-preview-2794--docusaurus-2.netlify.app

@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
Contributor

Deploy preview for docusaurus-2 ready!

Built with commit c800cab

https://deploy-preview-2794--docusaurus-2.netlify.app

Copy link
Contributor

@yangshun yangshun left a comment

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 facebook: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
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