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

swcMinify causes production builds to generate incorrect swagger documentation using next-swagger-doc #41992

Closed
1 task done
billythedummy opened this issue Oct 27, 2022 · 1 comment · Fixed by #42326
Closed
1 task done
Assignees

Comments

@billythedummy
Copy link

Verify canary release

  • I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #202210150742~1666053244~22.04~cf07008 SMP PREEMPT_DYNAMIC Tue O
Binaries:
  Node: 17.2.0
  npm: 8.1.4
  Yarn: 1.22.17
  pnpm: N/A
Relevant packages:
  next: 13.0.1-canary.0
  eslint-config-next: 13.0.0
  react: 18.2.0
  react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

Setting swcMinify: true in next config causes parameter arrays in OpenAPI documentation generated by next-swagger-doc / swagger-jsdoc to render only the last parameter in the array.

Expected Behavior

dev and prod output should not be different

Link to reproduction

https://github.com/billythedummy/swcminify-swagger-bug

To Reproduce

  • yarn install to install dependencies
  • When you run yarn dev, you should see all 3 params in the swagger documentation generated from the jsdoc in pages/api/hello.ts:

dev screenshot

  • However, when you create a production build with yarn build and run the production server with yarn start, all params but param3 are gone:

prod screenshot

The root cause seems to be somewhere in swcMinify. Setting swcMinify: false in next.config.js and running yarn build and yarn start again results in the correct output.

@billythedummy billythedummy added the bug Issue was opened via the bug report template. label Oct 27, 2022
@balazsorban44 balazsorban44 added kind: bug and removed bug Issue was opened via the bug report template. labels Oct 27, 2022
@kdy1 kdy1 self-assigned this Oct 27, 2022
kdy1 added a commit to swc-project/swc that referenced this issue Oct 28, 2022
huozhi pushed a commit that referenced this issue Nov 4, 2022
@github-actions
Copy link
Contributor

github-actions bot commented Dec 4, 2022

This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants