Skip to content

fix(v2): Consistently use require.resolve in official plugins to resolve modules - #2797

Merged
yangshun merged 2 commits into
meta:masterfrom
SamChou19815:require-resolve-loaders-in-plugins
May 23, 2020
Merged

yangshun merged 2 commits into
meta:masterfrom
SamChou19815:require-resolve-loaders-in-plugins

Conversation

@SamChou19815

@SamChou19815 SamChou19815 commented May 22, 2020 •

Copy link
Copy Markdown
Contributor

Motivation

Continuing the effort in #2788, #2794, using require.resolve to resolve absolute paths for loaders and client modules to ensure it can work under yarn pnp.

Have you read the Contributing Guidelines on pull requests?

Yes

Test Plan

The website can build, and preview can load.

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.)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label May 22, 2020
@docusaurus-bot

docusaurus-bot commented May 22, 2020 •

Copy link
Copy Markdown
Contributor

@SamChou19815 SamChou19815 changed the title fix(v2): Use require.resolve to resolve loaders in official plugins fix(v2): Consistently use require.resolve in official plugins to resolve modules May 22, 2020
@SamChou19815
SamChou19815 marked this pull request as ready for review May 22, 2020 22:54

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

Should we give guidance to plugin authors in the plugin docs to use require.resolve() so that people write pnp-compatible plugins?

@yangshun
yangshun merged commit 705f8f3 into meta:master May 23, 2020
@SamChou19815
SamChou19815 deleted the require-resolve-loaders-in-plugins branch May 23, 2020 03:27
@SamChou19815

SamChou19815 commented May 23, 2020 •

Copy link
Copy Markdown
Contributor Author

Should we give guidance to plugin authors in the plugin docs to use require.resolve() so that people write pnp-compatible plugins?

I think we should. I'm hoping that there is some docs on yarn website on how to write pnp compatible packages, but I couldn't find them, so I guess we have to write our own.

@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
…lve modules (meta#2797)

* fix(v2): Use require.resolve to resolve loaders in official plugins

* Use require.resolve to resolve client modules
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