sergiodxa / remix-i18next

The easiest way to translate your Remix apps
https://sergiodxa.github.io/remix-i18next/
MIT License
602 stars 44 forks source link

Module '"@remix-run/node"' has no exported member 'Response' #150

Closed yukosgiti closed 1 year ago

yukosgiti commented 1 year ago

Describe the bug

I copy pasted the code on the README and got this error.

Module '"@remix-run/node"' has no exported member 'Response'.ts(2305)

Your Example Website or App

local development

Steps to Reproduce the Bug or Issue

Copy past the codes on readme on Remix 2 tutorial app.

Error

Expected behavior

Response to be exported. There are response like types are exported but they are not classes so new Response doesn't workç

Screenshots or Videos

No response

Platform

Additional context

My package json:

"dependencies": { "@prisma/client": "5.3.1", "@remix-run/node": "2.0.0", "@remix-run/react": "2.0.0", "@remix-run/serve": "2.0.0", "i18next": "^23.5.1", "i18next-browser-languagedetector": "^7.1.0", "i18next-fs-backend": "^2.2.0", "i18next-http-backend": "^2.2.2", "isbot": "^3.6.13", "match-sorter": "^6.3.1", "react": "^18.2.0", "react-dom": "^18.2.0", "react-i18next": "^13.2.2", "remix-auth": "^3.5.1", "remix-auth-form": "^1.3.0", "remix-i18next": "^5.3.0", "sort-by": "^1.2.0", "tiny-invariant": "^1.3.1" }, "devDependencies": { "@remix-run/dev": "2.0.0", "@remix-run/eslint-config": "2.0.0", "@types/react": "^18.2.20", "@types/react-dom": "^18.2.7", "eslint": "^8.47.0", "eslint-plugin-unused-imports": "^3.0.0", "prettier": "^3.0.3", "prisma": "^5.3.1", "typescript": "^5.1.6" }

yukosgiti commented 1 year ago

Remix 2 documents changes needed here

https://remix.run/docs/en/main/start/v2#removal-of-exported-polyfills

Remove "import Response ..." from entry.server.tsx and add "import { renderToPipeableStream } from 'react-dom/server';"

create a variable stream like so const stream = createReadableStreamFromReadable(body); and use that object instead of body

yukosgiti commented 1 year ago
let body = new PassThrough();
const stream = createReadableStreamFromReadable(body);
responseHeaders.set('Content-Type', 'text/html');

resolve(
  new Response(stream, {
    headers: responseHeaders,
    status: didError ? 500 : responseStatusCode,
  })
);
bravik commented 10 months ago

@yukosgiti it would be nice to update the README...