avitorio / outstatic

Outstatic - A static CMS for Next.js
https://Outstatic.com
MIT License
2.67k stars 157 forks source link

Conflict Between Outstatic and Next.js Starting from next@v13.1.7-canary.9 Relating to swcMinify Setting #109

Closed avitorio closed 1 year ago

avitorio commented 1 year ago

Provide environment information

next: ^13.1.7-canary.9 outstatic: ^0.0.35-rc

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

No response

Describe the Bug

I'm encountering a conflict between Outstatic and Next.js starting from next@v13.1.7-canary.9. This issue only occurs during the build process and does not seem to be a problem during dev.

The error seems to be related to the swcMinify setting in Next.js. Currently, I can get Outstatic to work with any version of Next.js only if swcMinify is set to false inside next.config.js. When swcMinify is set to true, it appears the minification process is causing some issues with the variables from react-hook-form.

The issue happens when inside the Dashboard the user tries to either open or create a new document. Basically, the error throws everywhere with a form input.

image

Sometimes it also just shows a blank dashboard and complains that a variable has already been declared.

image

I have attempted to get an install working without needing to set swcMinify: false, but I have been unsuccessful so far.

I'd appreciate it if anyone has any insights or potential solutions for this issue. Please let me know if there is any additional information needed to diagnose this problem.

Thanks for your assistance in this matter.

Expected Behavior

Outstatic can be installed on Next.js without the need to set swcMinify: false inside next.config.js

The Dashboard is completely accessible, users can edit and create new documents, collections and custom fields.

Link to reproduction - Issues with a link to complete (but minimal) reproduction code will be addressed faster

https://github.com/avitorio/outstatic

To Reproduce

Deploy an example blog with vercel by clicking here.

Change next.config.js and set swcMinify: true.

Log in to /outstatic/ and try to create a new document.

avitorio commented 1 year ago

/bounty $50

algora-pbc[bot] commented 1 year ago

πŸ’Ž $50 bounty created by avitorio πŸ™‹ If you start working on this, comment /attempt #109 to notify everyone πŸ‘‰ To claim this bounty, submit a pull request that includes the text /claim #109 somewhere in its body πŸ“ Before proceeding, please make sure you can receive payouts in your country πŸ’΅ Payment arrives in your account 2-5 days after the bounty is rewarded πŸ’― You keep 100% of the bounty award πŸ™ Thank you for contributing to avitorio/outstatic!

avitorio commented 1 year ago

This is being solved on the swc side here: https://github.com/swc-project/swc/pull/7615