Describe the bug
I added a .gitignore file to my project. With an item listed in that file, building my site fails due to a template error. No templates are written.
To Reproduce
Steps to reproduce the behavior:
.gitignore file to your project root.npx @11ty/eleventy.Problem writing Eleventy templates: (more in DEBUG output)
> Invalid data format returned from ./node_modules/@11ty/eleventy/test/stubs/exports-flatdata.11ty.js: typeof string
`JavaScriptTemplateInvalidDataFormatError` was thrown:
JavaScriptTemplateInvalidDataFormatError: Invalid data format returned from ./node_modules/@11ty/eleventy/test/stubs/exports-flatdata.11ty.js: typeof string
at JavaScript.getExtraDataFromFile (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/Engines/JavaScript.js:94:15)
at async Template.getFrontMatterData (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/TemplateContent.js:132:21)
at async Template.getData (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/Template.js:212:29)
at async Template.getTemplateMapEntries (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/Template.js:681:16)
at async TemplateMap.add (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/TemplateMap.js:32:21)
at async Promise.all (index 1612)
at async TemplateWriter._createTemplateMap (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/TemplateWriter.js:132:5)
at async TemplateWriter.write (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/TemplateWriter.js:168:5)
at async Eleventy.write (/Users/<me>/programs/personal-site/node_modules/@11ty/eleventy/src/Eleventy.js:659:13)
Expected behavior
The site would build with all templates copied over.
Environment:
0.10.0Additional context
I have an .eleventyignore file in my project root as well (files are not duplicated between them). I tried listing the .gitignore file there, but it did not seem to make a difference.
https://www.11ty.dev/docs/ignores/#opt-out-of-using-.gitignore
eleventyConfig.setUseGitIgnore(false);
But the docs link above has some good info on .gitignore vs .eleventyignore vs node_modules, so definitely worth a quick read.
I also had this issue and was pretty bewildered until I landed here. Would it be possible to add a friendly prompt in the error message?
This is resolved in 0.11 already. It鈥檚 a problem with the npm package itself.
As @stevenpetryk mentioned above, it looks like this was indeed fixed. I just upgraded to v0.11 and can confirm I'm no longer seeing this problem. Thanks!
Also, not sure if the issue should be documented as part of this milestone.
Most helpful comment
This is resolved in 0.11 already. It鈥檚 a problem with the npm package itself.