avitorio / outstatic

Outstatic - A static CMS for Next.js

Home Page:https://Outstatic.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

avitorio opened this issue Β· comments

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.

/bounty $50

πŸ’Ž $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!

This is being solved on the swc side here: swc-project/swc#7615