Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tf-next build ignores distDir inside next.config.js and fails to build #147

Open
Stralos opened this issue Jun 22, 2021 · 5 comments
Open
Labels
component/CLI Feature request for the tf-next CLI feature/next.js Missing feature from Next.js

Comments

@Stralos
Copy link

Stralos commented Jun 22, 2021

Next js allows to provide a different dist directory inside next.config.js.

because of that getRoutesManifest() fails to find the routes-manifest file and fails the build

Node version: v16.3.0
Next version: v10.0.9
tf-next version: v0.7.0

To replicate:

  1. set distDir inside next.config.js to distDir: 'dist/.next'
  2. run tf-next build
@Stralos
Copy link
Author

Stralos commented Jun 22, 2021

Investigating further I found that a config is being passed to the builder function. It's just that the base path is never set:

buildCommand

this is where the default value for .next is set. https://github.com/dealmore/terraform-aws-next-js/blob/main/packages/runtime/src/index.ts#L242

So probably reading the next.config.js file and passing it's distDir to the build command would fix it.

@Stralos
Copy link
Author

Stralos commented Jun 22, 2021

Update nr 2:
we also need to set the correct path here:
https://github.com/dealmore/terraform-aws-next-js/blob/main/packages/tf-next/src/commands/build.ts#L212

as the temp directory would look for a .next folder at the root.

@ofhouse
Copy link
Member

ofhouse commented Jun 22, 2021

Hi, thanks for the detailed report.
Yep, should be supported, will take a look probably by the end of the week.

@ofhouse ofhouse added component/CLI Feature request for the tf-next CLI feature/next.js Missing feature from Next.js labels Jun 22, 2021
@aaronsisler
Copy link

Just checking if there is any plan to proceed with this fix? Thank you 😄

@ofhouse
Copy link
Member

ofhouse commented Nov 11, 2021

Oh yeah, my original estimation didn't age well 😅

Currently busy on pushing the v0.11.0 milestone so I currently have no new ETA on this.

Need to complete #86 first since this touches some code that would also be affected by this change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/CLI Feature request for the tf-next CLI feature/next.js Missing feature from Next.js
Projects
None yet
Development

No branches or pull requests

3 participants