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

(V2) Plugin resolution fails without require.resolve #2883

Closed
Dianoga opened this issue Jun 4, 2020 · 2 comments
Closed

(V2) Plugin resolution fails without require.resolve #2883

Dianoga opened this issue Jun 4, 2020 · 2 comments
Labels
bug An error in the Docusaurus core causing instability or issues with its execution

Comments

@Dianoga
Copy link

Dianoga commented Jun 4, 2020

🐛 Bug Report

When upgrading from 2.0.53 to 2.0.56 I was no longer able to run npm start as it would fail with an error that docusaurus-plugin-sass couldn't be found. I needed to modify the plugin line in docusaurus.config.js to use require.resolve instead of just the plugin name.

Have you read the Contributing Guidelines on issues?

Yes

To Reproduce

  1. Install 2.0.53
  2. Install a plugin (I used docusaurus-plugin-sass)
  3. Add plugin to docusaurus.config.js
    • plugins: ['docusaurus-plugin-sass']
  4. Run npm start
  5. Observe failure
  6. Change plugin config to: plugins: [require.resolve('docusaurus-plugin-sass')]
  7. Run npm start
  8. Observe proper behavior

Expected behavior

Docusaurs would start

Actual Behavior

± npm start

> [email protected] start /Users/Dianoga/projects/developer-docs
> docusaurus start

Starting the development server...
Error: Cannot find module 'docusaurus-plugin-sass'
Require stack:
- /Users/Dianoga/projects/developer-docs
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:982:15)
    at Function.resolve (internal/modules/cjs/helpers.js:83:19)
    at /Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/lib/server/plugins/init.js:40:67
    at Array.map (<anonymous>)
    at Object.initPlugins (/Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/lib/server/plugins/init.js:22:10)
    at Object.loadPlugins (/Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/lib/server/plugins/index.js:47:28)
    at Object.load (/Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/lib/server/index.js:57:62)
    at start (/Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/lib/commands/start.js:45:34)
    at /Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/bin/docusaurus.js:29:5
    at Command.<anonymous> (/Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/bin/docusaurus.js:97:23)
    at Command.listener (/Users/Dianoga/projects/developer-docs/node_modules/commander/index.js:370:29)
    at Command.emit (events.js:311:20)
    at Command.parseArgs (/Users/Dianoga/projects/developer-docs/node_modules/commander/index.js:892:12)
    at Command.parse (/Users/Dianoga/projects/developer-docs/node_modules/commander/index.js:642:21)
    at Object.<anonymous> (/Users/Dianoga/projects/developer-docs/node_modules/@docusaurus/core/bin/docusaurus.js:120:5)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)

Your Environment

  • Docusaurus version used: 2.0.0-alpha.56
  • Environment name and version: Node 12.16.1, NPM 6.13.4
  • Operating system and version (desktop or mobile): Mac

Reproducible Demo

I don't have one right now. Sorry!

@Dianoga Dianoga added bug An error in the Docusaurus core causing instability or issues with its execution status: needs triage This issue has not been triaged by maintainers labels Jun 4, 2020
@yangshun yangshun removed the status: needs triage This issue has not been triaged by maintainers label Jun 4, 2020
@yangshun
Copy link
Contributor

yangshun commented Jun 4, 2020

Thanks for reporting! It's both a bug and a breaking change. Read the release notes for the workaround. We'll release a fix soon such that you shouldn't need to do that.

@Dianoga
Copy link
Author

Dianoga commented Jun 4, 2020

Every time I actually report a bug somewhere I find that there's something obvious that I didn't see 🤦

Thanks for pointing out the release notes 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug An error in the Docusaurus core causing instability or issues with its execution
Projects
None yet
Development

No branches or pull requests

3 participants