aralroca / next-translate-plugin

Next-translate plugin for i18n in Next.js 🌍 - Load page translations and use them in an easy way!
MIT License
30 stars 17 forks source link

feat(deps): update typescript to v5.3.3 #78

Closed lluiscab closed 4 months ago

lluiscab commented 9 months ago

What is the purpose of this pull request?

This PR updates the typescript dependency to 5.3.3, the latest version available of TypeScript.

What changes did you make? (Give an overview)

I've updated src/utils.ts to the new API. All tests are passing locally.

kristian240 commented 4 months ago

Hi @bluelakee02 seems like this is could fix these:

kristian240 commented 4 months ago

@aralroca is it possible to get a new release with this changes?

lluiscab commented 4 months ago

Hi @aralroca, really awesome to fially see this PR merged. Could you also take a look at https://github.com/aralroca/next-translate-plugin/pull/79?

I could also open a PR to update to typescript@5.4.5 if needed / welcome.

aralroca commented 4 months ago

https://github.com/aralroca/next-translate-plugin/releases/tag/3.0.0-canary.4

aralroca commented 4 months ago

I see that now the pages example is broken, so probably we need to do more adaptations for the TypeScript parser migration:

Screenshot 2024-04-30 at 00 19 35
lluiscab commented 4 months ago

I'll try and see if I can take a look today.

kristian240 commented 4 months ago

Any update on this one?

lluiscab commented 4 months ago

@aralroca I've just executed next-translate/examples/complex with next-translate-plugin@3.0.0-canary.4 and it seems to be working correctly. Do you have a reproduction? image

kristian240 commented 4 months ago

Hey 👋🏼 !

Seems like this works on my end with 3.0.0-canary.4 however I needed to leave next-translate@2.6.2.

I have monorepo managed by yarn and with next-translate@3.0.0-canary.3 I was getting errors on build and dev

# BUILD

 ⚠ Linting is disabled
   ▲ Next.js 14.1.4
   - Environments: .env
   - Experiments (use at your own risk):
     · typedRoutes

   Creating an optimized production build ...
Failed to compile.

./node_modules/next/dist/pages/_app.js
Module not found: Can't resolve 'next-translate/appWithI18n'

https://nextjs.org/docs/messages/module-not-found

./src/services/i18n/TypeSafeTrans.tsx
Module not found: Can't resolve 'next-translate/Trans'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/ui/components/atoms/Toast/ToastStand.tsx

./src/services/i18n/hooks/use-type-safe-translation.ts
Module not found: Can't resolve 'next-translate/useTranslation'

https://nextjs.org/docs/messages/module-not-found

Import trace for requested module:
./src/ui/components/organisms/CookiePolicy.tsx

./src/app/(index)/page.tsx
Module not found: Can't resolve 'next-translate/AppDirI18nProvider'

https://nextjs.org/docs/messages/module-not-found

./src/app/(index)/page.tsx
Module not found: Can't resolve 'next-translate/loadNamespaces'

https://nextjs.org/docs/messages/module-not-found

> Build failed because of webpack errors
# DEV
 ✓ Compiled /src/middleware in 222ms (90 modules)
 ○ Compiling /trade ...
 ⨯ ./src/app/global-error.tsx:6:2
Module not found: Can't resolve 'next-translate/loadNamespaces'
  4 |   import { useSearchParams as __useSearchParams, useParams as __useParams } from 'next/navigation'
  5 |   import { use as __use, Suspense as __Suspense } from 'react'
> 6 |   import __loadNamespaces from 'next-translate/loadNamespaces'
    |  ^
  7 |
  8 |   ;
  9 | import { captureException } from '@sentry/nextjs';

https://nextjs.org/docs/messages/module-not-found
[HPM] GET /backend-api/user/me -> https://stg.my-app.com
 ⨯ ./src/app/global-error.tsx:6:2
Module not found: Can't resolve 'next-translate/loadNamespaces'
  4 |   import { useSearchParams as __useSearchParams, useParams as __useParams } from 'next/navigation'
  5 |   import { use as __use, Suspense as __Suspense } from 'react'
> 6 |   import __loadNamespaces from 'next-translate/loadNamespaces'
    |  ^
  7 |
  8 |   ;
  9 | import { captureException } from '@sentry/nextjs';

https://nextjs.org/docs/messages/module-not-found
 ⨯ ./src/app/global-error.tsx:6:2
Module not found: Can't resolve 'next-translate/loadNamespaces'
  4 |   import { useSearchParams as __useSearchParams, useParams as __useParams } from 'next/navigation'
  5 |   import { use as __use, Suspense as __Suspense } from 'react'
> 6 |   import __loadNamespaces from 'next-translate/loadNamespaces'
    |  ^
  7 |
  8 |   ;
  9 | import { captureException } from '@sentry/nextjs';

https://nextjs.org/docs/messages/module-not-found
 ⨯ ./node_modules/next/dist/pages/_app.js:16:20
Module not found: Can't resolve 'next-translate/appWithI18n'

https://nextjs.org/docs/messages/module-not-found
 ⨯ Error: ENOENT: no such file or directory, open '/Users/kristiandjakovic/work/my-app/apps/frontend/web/.next/fallback-build-manifest.json'
    at readFileSync (node:fs:453:20)
    at loadManifest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-manifest.js:35:54)
    at loadManifestWithRetries (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-components.js:40:51)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at process.processTimers (node:internal/timers:511:9)
    at async loadDefaultErrorComponentsImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-default-error-components.js:30:24)
    at async DevServer.getFallbackErrorComponents (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:582:16)
    at async DevServer.renderErrorToResponseImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:2123:40)
    at async DevServer.pipeImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:895:25)
    at async NextNodeServer.handleCatchallRenderRequest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/next-server.js:228:21)
    at async DevServer.handleRequestImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:791:17)
    at async /Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:331:20
    at async Span.traceAsyncFn (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/trace/trace.js:151:20)
    at async DevServer.handleRequest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:328:24)
    at async invokeRender (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:174:21)
    at async handleRequest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:353:24)
    at async NextCustomServer.requestHandlerImpl [as requestHandler] (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:377:13) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/kristiandjakovic/work/my-app/apps/frontend/web/.next/fallback-build-manifest.json'
}
Error: ENOENT: no such file or directory, open '/Users/kristiandjakovic/work/my-app/apps/frontend/web/.next/fallback-build-manifest.json'
    at readFileSync (node:fs:453:20)
    at loadManifest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-manifest.js:35:54)
    at loadManifestWithRetries (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-components.js:40:51)
    at runNextTicks (node:internal/process/task_queues:60:5)
    at process.processTimers (node:internal/timers:511:9)
    at async loadDefaultErrorComponentsImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-default-error-components.js:30:24)
    at async DevServer.getFallbackErrorComponents (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:582:16)
    at async DevServer.renderErrorToResponseImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:2123:40)
    at async DevServer.pipeImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:895:25)
    at async NextNodeServer.handleCatchallRenderRequest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/next-server.js:228:21)
    at async DevServer.handleRequestImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:791:17)
    at async /Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:331:20
    at async Span.traceAsyncFn (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/trace/trace.js:151:20)
    at async DevServer.handleRequest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:328:24)
    at async invokeRender (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:174:21)
    at async handleRequest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:353:24)
    at async NextCustomServer.requestHandlerImpl [as requestHandler] (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:377:13) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/kristiandjakovic/work/my-app/apps/frontend/web/.next/fallback-build-manifest.json'
}
Error: ENOENT: no such file or directory, open '/Users/kristiandjakovic/work/my-app/apps/frontend/web/.next/fallback-build-manifest.json'
    at readFileSync (node:fs:453:20)
    at loadManifest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-manifest.js:35:54)
    at loadManifestWithRetries (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-components.js:40:51)
    at async loadDefaultErrorComponentsImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/load-default-error-components.js:30:24)
    at async DevServer.getFallbackErrorComponents (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:582:16)
    at async DevServer.renderErrorToResponseImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:2123:40)
    at async pipe.req.req (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:1976:30)
    at async DevServer.pipeImpl (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/base-server.js:895:25)
    at async /Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:331:20
    at async Span.traceAsyncFn (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/trace/trace.js:151:20)
    at async DevServer.handleRequest (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/dev/next-dev-server.js:328:24)
    at async invokeRender (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:174:21)
    at async NextCustomServer.requestHandlerImpl [as requestHandler] (/Users/kristiandjakovic/work/my-app/apps/frontend/web/node_modules/next/dist/server/lib/router-server.js:389:24) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'open',
  path: '/Users/kristiandjakovic/work/my-app/apps/frontend/web/.next/fallback-build-manifest.json'
}
kristian240 commented 4 months ago

Should I/we create a new issue for this?

aralroca commented 4 months ago

@aralroca I've just executed next-translate/examples/complex with next-translate-plugin@3.0.0-canary.4 and it seems to be working correctly. Do you have a reproduction? image

Nothing special, just update the dependency and run yarn example:complex, it's like it's taking the _default language. I have tried it in both master and canary branch, it happens in both. Do you have the updated branch? it is not some new change from the 3.0.0 version we are working on.

Screenshot 2024-05-14 at 21 33 35