Open mdekstrand opened 6 years ago
@mdekstrand Hi, please show the error and best of all an example of reproducing this error, and even better place it in the repository. Thank you.
Here is the error:
TypeError: Cannot set property 'contents' of undefined
at require.process.then (C:\Users\michaelekstrand\Documents\md.ekstrandom.net\node_modules\metalsmith-posthtml\index.js:23:32)
at <anonymous>
I don't currently have a minimal reproducer, though I have identified the specific problem in the metalsmith-posthtml
code.
Problem
The plugin calls the Metalsmith callback once for each file processed, instead of once when file processing is complete.
This results in many problems, one of which is allowing other Metalsmith plugins to run and modify the files (or delete or rename them!) while PostHTML page processing is happening.
This is manifesting as unhandled rejected promises, and I traced it to the incorrect use of the Metalsmith callback.