next.js: swcMinify: true - ReferenceError: Can't find variable: excludeEmptyString
What version of Next.js are you using?
12.0.1
What version of Node.js are you using?
16.10.0
What browser are you using?
Safari
What operating system are you using?
MacOS
How are you deploying your application?
Vercel
Describe the Bug
I’m sure its connected to other issues, but thought I’d provide some more context.
Setting the swcMinify config to true seems to break something in the runtime as it successfully builds and deploys, but then when navigating to certain pages I get:
ReferenceError: Can't find variable: excludeEmptyString
matches — string.js:75
(anonymous function) — <some-page>.tsx:33
g — bootstrap:22
(anonymous function) — _N_E:6
promiseReactionJob
Expected Behavior
Not error 😃
To Reproduce
Our team has a boilerplate repo we use on all our projects:
https://github.com/NoQuarterTeam/boilerplate
- cd into packages/web
- change the next.config.js file to set swcMinify to true
- yarn build
- yarn start
- Navigate to /login
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 10
- Comments: 21 (7 by maintainers)
@JClackett it’s
yuppackage, maybe you have some custom validations.We have come across a similar issue with yup email:
Yup.string().email(t('validEmail')).required(t('required'))Yeah I do! is this documented as to why this wouldn’t work with swc minification? and if there’s a fix?
Example yup code:
Hey @rodilo!
Yeah, I get that too. If it’s yup your using, it seems the swc compiler is incompatible with
yup version >0.32.10. You can use a lower version likeyup version ^0.32.9or setswcMinify: falseI also think there is a canary version of Next 12 that addresses this issue. You can use install
next@canaryand redeploy to production.