Skip to content

Conversation

beliolfa
Copy link

In the giving example

  fs.writeFileSync(api.entryFile, contentMain, { encoding: 'utf-8' })

it was being written back the original content instead of the modified lines. I've changed the approach adding the new line to the array and then joining it back.

  lines.splice(renderIndex, 0, `  router,`)
  const newContent = lines.join('\r\n')
  fs.writeFileSync(api.entryFile, newContent, { encoding: 'utf-8' })

@haoqunjiang
Copy link
Member

Thanks for this pull request and sorry for the late reply.
But we found #3656 to be a better fix for this example.
Thanks again though, your help is much appreciated.

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

Successfully merging this pull request may close these issues.

2 participants