exhibitionist-digital / ultra

Zero-Legacy Deno/React Suspense SSR Framework

Home Page:https://ultrajs.dev

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`deno task start` fails on newly created project

mbhrznr opened this issue · comments

steps to reproduce:

  1. create a new ultra project w/:
    deno run -A -r https://deno.land/x/ultra/create.ts
  2. build the project w/:
    deno task build
  3. navigate into the build dir and try to serve the project:
    cd .ultra/ && deno task start

the following error pops up:

Task start ULTRA_MODE=production deno run -A --no-remote ./server.js
error: Uncaught SyntaxError: The requested module 'react-dom/server' does not provide an export named 'renderToString'
import { renderToString } from "react-dom/server";

taking a look at the .ultra directory and especially at importMap.server.json it looks like there's a mismatch in the linked dependencies:

{
  "imports": {
    "./server.tsx": "./server.js",
    "./src/app.tsx": "./src/app.c8559919.js",
    "https://deno.land/": "./vendor/server/deno.land/",
    "https://esm.sh/": "./vendor/server/esm.sh/",
    "react/jsx-runtime": "./vendor/server/esm.sh/stable/react@18.2.0/deno/react.mjs",
    "ultra/server.ts": "./vendor/server/deno.land/x/ultra@v2.3.1/server.ts",
    "ultra/hooks/use-asset.js": "./vendor/server/deno.land/x/ultra@v2.3.1/hooks/use-asset.js",
    "react": "./vendor/server/esm.sh/stable/react@18.2.0/deno/react.mjs",
    "react-dom/server": "./vendor/server/esm.sh/stable/react@18.2.0/deno/react.mjs"
  },
  "scopes": {
    "./vendor/server/deno.land/": {
      "/std@0.176.0/": "./vendor/server/deno.land/std@0.176.0/",
      "/std@0.97.0/": "./vendor/server/deno.land/std@0.97.0/",
      "/x/": "./vendor/server/deno.land/x/"
    },
    "./vendor/server/esm.sh/": {
      "/stable/": "./vendor/server/esm.sh/stable/"
    }
  }
}

rather than linking to react-dom/server, esm.sh seems to link to react again, thus failing to find the import.

i assume the underlying issue could also be caused by esm.sh?

Thanks for reporting! I think it could be due to the fact that esm.sh changed how it handles waterfall dependencies and the wrong module is being detected during the build

Could you try the latest release? You should only need to update your import map for ultra

works like a charm! thank you so much for the quick fix!