docusaurus icon indicating copy to clipboard operation
docusaurus copied to clipboard

Files in node_modules are parsed on build

Open glecetre opened this issue 6 years ago • 2 comments

🐛 Bug Report

When running the command npm run build, files in the node_modules folder are checked by the engine.

This creates a lot of unnecessary overhead and logs many errors in the console like so:

[WARN] unresolved links in file 'website/node_modules/mixin-deep/node_modules/is-extendable/README.md' > [ '.verb.md' ] [WARN] unresolved links in file 'website/node_modules/mixin-deep/README.md' > [ '.verb.md' ] [WARN] unresolved links in file 'website/node_modules/nanomatch/README.md' > [ '.github/contributing.md', '.verb.md' ]

There also are some errors logged from the fixture files for the tests:

Header field "unlisted" in /home/jeahel/dev/the-hive/documentation/website/node_modules/docusaurus/lib/core/__tests__/__fixtures__/blog-post-with-draft.md is not supported. Header field "authorTwitter" in /home/jeahel/dev/the-hive/documentation/website/node_modules/docusaurus/lib/server/__tests__/__fixtures__/2018-08-17-docusaurus.md is not supported.

And some errors with BABEL, still in the node_modules folder:

[BABEL] Note: The code generator has deoptimised the styling of /home/jeahel/dev/the-hive/documentation/website/node_modules/docusaurus/lib/core/metadata.js as it exceeds the max of 500KB.

Have you read the Contributing Guidelines on issues?

I have.

To Reproduce

  1. Create a new Docusaurus project with docusaurus-init
  2. Build the website with cd website && npm run build
  3. Look at the console output

Expected behavior

I expect the engine not to go through the node_modules/ folder not to waste time, and no log errors about files I am not supposed/required to know about (errors about the fixtures and BABEL).

Actual Behavior

The opposite: all files from the dependencies in node_modules/ are parsed, and errors about unknown files are printed out.

Reproducible Demo

No need to clone a repo, juste create a new Docusaurus project with npx docusaurus-init.

glecetre avatar Jan 13 '20 13:01 glecetre

Hi @glecetre, are you still seeing this issue? This is what I'm seeing:

Screen Shot 2020-02-10 at 10 16 01 AM

strtw avatar Feb 10 '20 18:02 strtw

I understood the problem and I'm sorry I did not come back sooner. In my config file, I had changed the customDocsPath setting to avoid having a /docs folder, so I used the value ./. So of course there was the website folder, containing node_modules, and it was parsed by the engine.

Maybe you would want to change that behaviour to prevent parsing the website folder, but my bug in itself can be closed.

Thanks

glecetre avatar Feb 11 '20 08:02 glecetre