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

"Module not found: Can't resolve 'fs'" with Next.js 12 #1173

Closed
alexbu92 opened this issue Nov 29, 2021 · 1 comment
Closed

"Module not found: Can't resolve 'fs'" with Next.js 12 #1173

alexbu92 opened this issue Nov 29, 2021 · 1 comment

Comments

@alexbu92
Copy link

Describe the bug
After installing the npm packages, creating a lingui.config.js and trying to use the Trans macro in a component like so:

import { Trans } from '@lingui/macro'

export default function Test() {
    return (<Trans>testing</Trans>)
}

compilation errors out with:

error - ./node_modules/@lingui/conf/index.js:22:0
Module not found: Can't resolve 'fs'

Import trace for requested module:
./node_modules/@lingui/macro/index.js
./src/components/Test.tsx
...

I've seen solutions mentioning adding the babel plugin, but Next.js 12 doesn't use Babel anymore.

Can I get the macros to work or should I fallback to the React Lingui components?

@semoal
Copy link
Collaborator

semoal commented Nov 29, 2021

Lingui depend exclusively of Babel and his macros. Until nextjs with SWC doesn’t offer a way of parsing AST we can’t do much here. Sorry
Ps: nextjs still uses babel if you provide a babelrc

@semoal semoal closed this as completed Nov 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants