Skip to content

Conversation

halkeye
Copy link

@halkeye halkeye commented Oct 2, 2021

Surround the copy with mkdirp
switch console.log to reporter

@halkeye
Copy link
Author

halkeye commented Oct 2, 2021

okay i decided to not use the plugin, its easy enough to just do the folowing onCreateNode

  if (node.internal.type === 'File') {
    if (node.sourceInstanceName === 'images') {
      const dir = path.join(__dirname, 'public', 'images', node.relativeDirectory);
      await fs.promises.mkdir(dir, { recursive: true });
      await fs.promises.copyFile(node.absolutePath, path.join(dir, node.base));
    }
  }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant