scinos / metal-folds-11ty

My metamodels.page blog
MIT License
0 stars 0 forks source link

Unclear error when forgetting to export from .jsx #1

Closed burntcustard closed 1 year ago

burntcustard commented 2 years ago

Hi! I was just trying this out, and was getting the error Cannot read properties of undefined (reading 'eleventyDataKey') (via TypeError) - after a few minutes of head scratching I figured it was because I was forgetting to export default MyReactComponent out of a .jsx file.

I'm wondering if there's a way to give a more explicit or helpful error?

Full log:

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] Cannot read properties of undefined (reading 'eleventyDataKey') (via TypeError)
[11ty] 
[11ty] Original error stack trace: TypeError: Cannot read properties of undefined (reading 'eleventyDataKey')
[11ty]     at CustomEngine.getExtraDataFromFile (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/Engines/Custom.js:112:14)
[11ty]     at processTicksAndRejections (node:internal/process/task_queues:95:5)
[11ty]     at Template.getFrontMatterData (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/TemplateContent.js:212:21)
[11ty]     at Template.getData (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/Template.js:408:29)
[11ty]     at Template.getTemplateMapEntries (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/Template.js:1087:33)
[11ty]     at TemplateMap.add (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/TemplateMap.js:59:21)
[11ty]     at async Promise.all (index 0)
[11ty]     at TemplateWriter._createTemplateMap (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/TemplateWriter.js:243:5)
[11ty]     at TemplateWriter.generateTemplates (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/TemplateWriter.js:277:5)
[11ty]     at TemplateWriter.write (/home/burntcustard/Documents/burnt.io/node_modules/@11ty/eleventy/src/TemplateWriter.js:323:23)
[11ty] Wrote 0 files in 0.39 seconds (v1.0.1)
burntcustard commented 2 years ago

This was supposed to be on the eleventy-plugin-react-ssr repo, apologies, I've been awake for too long 😂 Although https://github.com/scinos/eleventy-plugin-react-ssr is 404'ing? Kind of like it's recently been made private?

scinos commented 2 years ago

Moved to public, thanks!!

Regarding the issue, I'll see what I can do.