cloudfront-hosting-toolkit icon indicating copy to clipboard operation
cloudfront-hosting-toolkit copied to clipboard

Bug:/Idea: `npx next export` is not supported anymore in Next.js

Open AlessandroVol23 opened this issue 1 year ago • 2 comments

Expected Behaviour

I used the default next.js starter kit npx create-next-app@latest nextjs-blog --use-pnpm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter"

My expected behaviour would be that the deploy step is deploying the static files.

Current Behaviour

The build step fails with the following logs:

[Container] 2024/06/05 06:01:35.090350 Running command npx next export
73 | ⨯
74 | `next export` has been removed in favor of 'output: export' in next.config.js.
75 | Learn more: https://nextjs.org/docs/app/building-your-application/deploying/static-exports
76 |  
77

I know that only SSG and SPA are supported right now. But I think the developer experience could be improved if the CLI locally already fails or if the build command understands that next version xyz is not supporting this command anymore.

Code snippet

1. `npx create-next-app@latest nextjs-blog --use-pnpm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter"`
2. `cloudfront-hosting-toolkit init`
3. `cloudfront-hosting-toolkit deploy`

Possible Solution

Show a warning locally / break locally

Steps to Reproduce

  1. npx create-next-app@latest nextjs-blog --use-pnpm --example "https://github.com/vercel/next-learn/tree/main/basics/learn-starter"
  2. cloudfront-hosting-toolkit init
  3. cloudfront-hosting-toolkit deploy

AlessandroVol23 avatar Jun 08 '24 07:06 AlessandroVol23

Hi, Thank you for creating the issue. I think I may have an idea for a nice and clean fix: identify the build command from package.json and execute it as it is instead of manually using the build cmd in the yml file.

cornelcroi avatar Jun 08 '24 07:06 cornelcroi

Hey 👋🏽 yers that sounds like a good approach. I'm not sure in which version this was changed. I couldn't find it right now sorry.

AlessandroVol23 avatar Jun 08 '24 15:06 AlessandroVol23