hozana / next-translate-routes

Flexible and translated routes for Next.js without custom server
MIT License
115 stars 31 forks source link

Module not found: Can't resolve 'next/dist/shared/lib/router-context' #80

Closed sdk1990 closed 11 months ago

sdk1990 commented 1 year ago

On the latest version of Next.js (13.5.1), compilation fails due to a Next module which is not found within the next-translate-routes package.

This is the message which is shown in my console: ../../node_modules/next-translate-routes/react/withTranslateRoutes.js:38:0 Module not found: Can't resolve 'next/dist/shared/lib/router-context'

NSpehler commented 1 year ago

It seems to be because the RouterContext is now exported from:

import { RouterContext } from 'next/dist/shared/lib/router-context.shared-runtime'

Instead of:

import { RouterContext } from 'next/dist/shared/lib/router-context'
sdk1990 commented 1 year ago

@cvolant I created #81 with a fix for this issue

nedimcimpo commented 8 months ago

@cvolant Still an issue. Just tried with latest nextjs (page router) and getting this error

package.json

{
  "name": "test-translate-route",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "next": "14.0.4",
    "next-translate-routes": "^1.10.2",
    "react": "^18",
    "react-dom": "^18"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.0.1",
    "eslint": "^8",
    "eslint-config-next": "14.0.4",
    "postcss": "^8",
    "tailwindcss": "^3.3.0",
    "typescript": "^5"
  }
}