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

Change default node_modules ignores #2436

Closed
zachleat opened this issue Jun 14, 2022 · 1 comment
Closed

Change default node_modules ignores #2436

zachleat opened this issue Jun 14, 2022 · 1 comment
Labels
breaking-change This will have to be included with a major version as it breaks backwards compatibility. bug feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc

Comments

@zachleat
Copy link
Member

The eleventy-base-blog build fails after you add a Netlify plugin. Here’s some build log output from the eleventy-base-blog project but would likely be the similar for any Eleventy 0.x, 1.x, or 2.x project:

0:20:59 AM: [11ty] Problem writing Eleventy templates: (more in DEBUG output)
10:20:59 AM: [11ty] 1. Having trouble rendering njk template ./.netlify/plugins/node_modules/accepts/README.md (via TemplateContentRenderError)
10:20:59 AM: [11ty] 2. "sh" is not a valid Prism.js language for eleventy-plugin-syntaxhighlight (via Error)
10:20:59 AM: [11ty]
10:20:59 AM: [11ty] Original error stack trace: Error: "sh" is not a valid Prism.js language for eleventy-plugin-syntaxhighlight
10:20:59 AM: [11ty]     at module.exports (/opt/build/repo/node_modules/@11ty/eleventy-plugin-syntaxhighlight/src/PrismLoader.js:20:11)
10:20:59 AM: [11ty]     at Object.highlight (/opt/build/repo/node_modules/@11ty/eleventy-plugin-syntaxhighlight/src/markdownSyntaxHighlightOptions.js:25:35)
10:20:59 AM: [11ty]     at Object.default_rules.fence (/opt/build/repo/node_modules/markdown-it/lib/renderer.js:53:27)
10:20:59 AM: [11ty]     at Renderer.render (/opt/build/repo/node_modules/markdown-it/lib/renderer.js:332:38)
10:20:59 AM: [11ty]     at MarkdownIt.render (/opt/build/repo/node_modules/markdown-it/lib/index.js:544:24)
10:20:59 AM: [11ty]     at /opt/build/repo/node_modules/@11ty/eleventy/src/Engines/Markdown.js:74:38
10:20:59 AM: [11ty]     at processTicksAndRejections (node:internal/process/task_queues:96:5)
10:20:59 AM: [11ty]     at async Template._render (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateContent.js:432:22)
10:20:59 AM: [11ty]     at async Template.getTemplateMapContent (/opt/build/repo/node_modules/@11ty/eleventy/src/Template.js:1077:19)
10:20:59 AM: [11ty]     at async TemplateMap.populateContentDataInMap (/opt/build/repo/node_modules/@11ty/eleventy/src/TemplateMap.js:461:39)
10:20:59 AM: [11ty] Copied 4 files / Wrote 0 files in 0.69 seconds (v1.0.1)

Note that it attempts to process content in .netlify/plugins/node_modules/

Workaround

Workaround is to add .netlify to either the .gitignore, .eleventyignore, or in the configuration API method: https://www.11ty.dev/docs/ignores/#configuration-api

Defaults change discussion

Taking it one step further, my personal thought is that it might be better to change the Eleventy default ignore from node_modules/** to **/node_modules/**. Or in addition to? (note the delete snippet recommendation on https://www.11ty.dev/docs/ignores/#node_modules)

Thoughts?

Reported by @samkap!

@zachleat zachleat added bug needs-discussion Please leave your opinion! This request is open for feedback from devs. breaking-change This will have to be included with a major version as it breaks backwards compatibility. labels Jun 14, 2022
@zachleat zachleat added the feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc label Jun 29, 2022
@zachleat zachleat added this to the Eleventy 2.0.0 milestone Jul 28, 2022
@zachleat
Copy link
Member Author

Fixed by #2492.

Shipping with Eleventy 2.0.0-canary.15

@zachleat zachleat removed the needs-discussion Please leave your opinion! This request is open for feedback from devs. label Aug 15, 2022
zachleat added a commit to 11ty/11ty-website that referenced this issue Aug 15, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking-change This will have to be included with a major version as it breaks backwards compatibility. bug feature: 🪞 ignores Ignores, via configuration API or .eleventyignore or .gitignore etc
Projects
None yet
Development

No branches or pull requests

1 participant