hozana / next-translate-routes

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

TypeError: withTranslateRoutes is not a function #1

Closed hairmenu closed 3 years ago

hairmenu commented 3 years ago

Hi

i was so happy to find this package because it matches 100% of the needs and i could not agree more with the motivation. However, i made a fresh Next.js install then just npm install next-translate-routes so my package looks like this { "name": "next-poc", "version": "0.1.0", "private": true, "scripts": { "dev": "next dev", "build": "next build", "start": "next start", "lint": "next lint" }, "dependencies": { "next": "11.0.1", "next-translate-routes": "^1.1.0", "react": "17.0.2", "react-dom": "17.0.2" }, "devDependencies": { "eslint": "7.32.0", "eslint-config-next": "11.0.1" } } edited next.config.js as describe `const withTranslateRoutes = require('next-translate-routes/plugin')

module.exports = withTranslateRoutes({ reactStrictMode: true, // Next i18n config (mandatory): https://nextjs.org/docs/advanced-features/i18n-routing i18n: { locales: ['en', 'fr', 'es', 'pl'], defaultLocale: 'pl', },

// ...Remaining next config }) `

nothing else and i got the following when running ready - started server on 0.0.0.0:3000, url: http://localhost:3000 TypeError: withTranslateRoutes is not a function at Object.<anonymous> (/[mypath]/next-poc/next.config.js:3:18) at Module._compile (internal/modules/cjs/loader.js:1137:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) at Module.load (internal/modules/cjs/loader.js:985:32) at Function.Module._load (internal/modules/cjs/loader.js:878:14) at Module.require (internal/modules/cjs/loader.js:1025:19)

what is wrong? tx

cvolant commented 3 years ago

Since you posted this issue (a while ago, sorry that I did not answer it), fixes and improvements have been added, and it should be fixed for some time now. I am closing this issue: if it is not fixed for you with the new version, please add a comment (if possible, with a link to a repro so that I can identify what is wrong): I will reopen it.