Module not found: Can't resolve 'next-translate/appWithI18n'

365 views Asked by At

A problem occurs when applying next-translate in yarn workspace monorepo, nextjs 13 environment.

environment:

app package.json

  "name": "admin-coaching",
  "packageManager": "[email protected]",
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "analyze": "ANALYZE=true yarn build"
  },
  "dependencies": {
    "@mdx-js/loader": "2.3.0",
    "@mdx-js/react": "2.3.0",
    "@next/mdx": "13.2.1",
    "next": "13.2.0",
    "next-translate": "2.0.1",
    "react": "18.2.0",
    "react-dom": "18.2.0"
  },
  "devDependencies": {
    "@next/bundle-analyzer": "13.1.6",
    "@types/node": "18.13.0",
    "@types/react": "18.0.28",
    "next-translate-plugin": "2.0.2",
    "typescript": "4.9.5"
  }
}

help me ~

It works normally in the yarn berry environment, but it doesn't work only in the monorepo environment.

1

There are 1 answers

0
Mark Alexander On

Got the same issue with the same configuration as you (except that I'm using NextJS 14). I just switched to next-intl and now everything works fine!