Skip to content

Remove intermediary copy steps #43

Closed
@ehmicky

Description

@ehmicky

All Next.js page/function files are initially copied by next-on-netlify to out_functions and out_publish.
This plugin then copies all those files from out_functions and out_publish to the site's Functions/publish directories.

If those are lots of files, this additional copy step might end take lots of build time. Instead, we could remove that intermediary step:

  • Make the main function exported by netlify-on-netlify accepts an options object so users can customize the location of out_functions and out_publish:

https://github.com/netlify/next-on-netlify/blob/a9dade3824d1288770d967cc6f57f238d5947367/index.js#L7

const nextOnNetlify = ({ functionsDir = "out_functions", publishDir = "out_publish" } = {}) => {
  • Pass constants.FUNCTIONS_SRC and constants.PUBLISH_DIR to next-on-netlify
  • Remove the additional copy step 🎉

https://github.com/netlify/netlify-plugin-nextjs/blob/84c6f7f4ccfd6d814bd642d0a27921ef49b67c25/index.js#L74

As a follow-up, we can also expose those to next-on-netlify CLI.

What do you think @lindsaylevine?

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions