You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ERROR #11321 PLUGIN
"gatsby-plugin-doctype" threw an error while running the onPostBuild lifecycle:
EISDIR: illegal operation on a directory, read
Error: EISDIR: illegal operation on a directory, read
Added code to the plugin, found the cause is the 404.html folder:
public/page-data/404.html
Local hacked it:
const glob = require(`tiny-glob`)
const fs = require(`fs-extra`)
async function getContent(filePath, encoding = 'utf-8') {
if (!filePath) {
throw new Error('filePath required or not found')
}
if (fs.lstatSync(filePath).isDirectory() ) {
console.log ('*******************' + filePath + ' is a directory')
return null
}
return fs.readFile(filePath, { encoding })
}
exports.onPostBuild = async (_, { doctype = `html` }) => {
const files = await glob(`public/**/*.html`)
for (const file of files) {
const originalContent = await getContent(file)
if (originalContent == null)
{
continue;
}
const stripped = originalContent.slice(15)
const start = `<!DOCTYPE ${doctype}>`
const modifiedContent = `${start}${stripped}`
await fs.writeFile(file, modifiedContent)
}
}
The text was updated successfully, but these errors were encountered:
On build:
Added code to the plugin, found the cause is the 404.html folder:
public/page-data/404.html
Local hacked it:
The text was updated successfully, but these errors were encountered: