I'm migrating a large application created with CRA to Vite.js
I followed this guide to configure the new bundler with the existing app and now everything seems fine when running the development server.
However, when trying to compile the production build, I run in the following error:
vite v2.6.14 building for production...
✓ 162 modules transformed.
[vite:react-jsx] unknown: Maximum call stack size exceeded
file: /Users/matteocarpi/Documents/Web/philip-morris/aws-amplify-multi-tenant/node_modules/react-i18next/dist/es/Trans.js
error during build:
RangeError: unknown: Maximum call stack size exceeded
at getJSXProps (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/vite-react-jsx/dist/cjs/babelRestoreJsx.js:79:29)
at getJSXNode (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/vite-react-jsx/dist/cjs/babelRestoreJsx.js:31:23)
at PluginPass.CallExpression (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/vite-react-jsx/dist/cjs/babelRestoreJsx.js:165:30)
at newFn (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/@babel/traverse/lib/visitors.js:177:21)
at NodePath._call (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/@babel/traverse/lib/path/context.js:53:20)
at NodePath.call (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/@babel/traverse/lib/path/context.js:40:17)
at NodePath.visit (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/@babel/traverse/lib/path/context.js:100:31)
at TraversalContext.visitQueue (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/@babel/traverse/lib/context.js:103:16)
at TraversalContext.visitQueue (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/@babel/traverse/lib/context.js:109:21)
at TraversalContext.visitQueue (/Users/matteocarpi/Documents/Web/aws-amplify-multi-tenant/node_modules/@babel/traverse/lib/context.js:109:21)
I understand it's something to do with Babel and i18next, but I'm a bit stuck in what the specific problem is.
Any tips on how to debug further?
Thanks in advance,
M