eleventy-plugin-react icon indicating copy to clipboard operation
eleventy-plugin-react copied to clipboard

API incompatibility with Eleventy 1.0

Open mraerino opened this issue 3 years ago • 1 comments

When trying this Plugin with Eleventy 1.0 I get this error:

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] > Having trouble writing template: _site/posts/hello/index.html

`TemplateWriterWriteError` was thrown
[11ty] > The "path" argument must be of type string. Received undefined

`TypeError` was thrown:
[11ty]     TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received undefined
        at new NodeError (node:internal/errors:370:5)
        at validateString (node:internal/validators:119:11)
        at Object.resolve (node:path:1098:7)
        at Object.<anonymous> (/Users/christine/code/kalkspace-relaunch/node_modules/eleventy-plugin-react/lib/plugin.js:122:28)
        at Template.runTransforms (/Users/christine/code/kalkspace-relaunch/node_modules/@11ty/eleventy/src/Template.js:553:38)
        at async Template.renderPageEntry (/Users/christine/code/kalkspace-relaunch/node_modules/@11ty/eleventy/src/Template.js:848:15)
        at async /Users/christine/code/kalkspace-relaunch/node_modules/@11ty/eleventy/src/Template.js:872:21
        at async Promise.all (index 0)
        at async Promise.all (index 2)
        at async Eleventy.executeBuild (/Users/christine/code/kalkspace-relaunch/node_modules/@11ty/eleventy/src/Eleventy.js:986:13)

this is likely because, the function context for addTransform callbacks no longer passes outputDir: https://github.com/11ty/eleventy/blob/08fe54e03da025cda24c4b25b5b8a8d0007b4689/src/Template.js#L552-L556 consider using path.dirname(outputPath) instead.

mraerino avatar Jan 21 '22 15:01 mraerino

Yeah, this hasn't been updated since v1.0 was released. Haven't had time since it was released, but will hopefully get to it soon. In the meantime, PRs are definitely welcome!

kaicataldo avatar Jan 24 '22 21:01 kaicataldo