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

next-i18next incompatiblity #115

Closed
rkurbatov opened this issue May 30, 2024 · 4 comments
Closed

next-i18next incompatiblity #115

rkurbatov opened this issue May 30, 2024 · 4 comments
Assignees
Labels

Comments

@rkurbatov
Copy link

rkurbatov commented May 30, 2024

Steps to reproduce

Hi there. We have pretty old project with NextJS 12 and @emotion that has to be upgraded.

There are lots of dependencies, the whole circle of problems so I wanted initially to use the codemod and some manual changes to replace @emotion with Pigment CSS while staying on NextJS 12 (later versions don't support @emotion).

The problem is the application is failing now on the app.prepare() stage if I try to run it. Just a silent fail with status 0. No debugging messages, cannot catch anything. And the build process simply hangs running indefinitely.

The problem disappears when I remove withPigment() wrapper from nextjs config. That doesn't happen on NextJS 13 though there I have other non-related issues so I just want to make smal incremental updates.

I know that Pigment supports NextJS 12 but seems like there is something preventing it to work properly. Had somebody similar issues?

Current behavior

No response

Expected behavior

No response

Context

No response

Your environment

npx @mui/envinfo
  Don't forget to mention which browser you used.
  Output from `npx @mui/envinfo` goes here.

Search keywords: NextJS12

@rkurbatov rkurbatov added the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label May 30, 2024
@oliviertassinari
Copy link
Member

oliviertassinari commented Jun 1, 2024

@rkurbatov Do you have a minimal bug reproduction that we can look into?

@rkurbatov rkurbatov changed the title NextJS 12 project fails with PigmentCSS next-i18next incompatiblity Jul 24, 2024
@rkurbatov
Copy link
Author

rkurbatov commented Jul 24, 2024

I traced down the issue and it seems like it's next-i18next package that causes the problem.

Here I have the minimal repo: https://github.com/rkurbatov/acq-test

It works even if I use withPigment wrapper but once I use css function in the _error (or any other) page I have the following error:

EvalError: Cannot read properties of null (reading 'default') in/home/rkurbatov/WebstormProjects/acq-test/node_modules/.pnpm/[email protected]/node_modules/i18next-fs-backend/cjs/fs.js
| /home/rkurbatov/WebstormProjects/acq-test/node_modules/.pnpm/[email protected]/node_modules/i18next-fs-backend/cjs/readFile.js
| /home/rkurbatov/WebstormProjects/acq-test/node_modules/.pnpm/[email protected]/node_modules/i18next-fs-backend/cjs/index.js
| /home/rkurbatov/WebstormProjects/acq-test/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/next-i18next/dist/commonjs/createClient/node.js
| /home/rkurbatov/WebstormProjects/acq-test/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/next-i18next/dist/commonjs/appWithTranslation.js
| /home/rkurbatov/WebstormProjects/acq-test/node_modules/.pnpm/[email protected][email protected][email protected][email protected][email protected]/node_modules/next-i18next/dist/commonjs/index.js
| /home/rkurbatov/WebstormProjects/acq-test/pages/_error.tsx

NextJS has complete mess with modules, imports and module types and seems like pigment makes someing additional with such imports breaking it even more.

cc @oliviertassinari

@rkurbatov
Copy link
Author

rkurbatov commented Jul 26, 2024

cc @brijeshb42

 unhandledRejection: /home/rkurbatov/WebstormProjects/acq-test/node_modules/.pnpm/@[email protected][email protected]/node_modules/@wyw-in-js/transform/lib/module.js:224
      throw new EvalError(`${e.message} in${this.callstack.join('\n| ')}\n`);

Can I avoid compilation of that module somehow? Or processing of it by pigment, whatever?

@rkurbatov
Copy link
Author

The issue resolved after updating next-i18next package

@github-actions github-actions bot removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants