Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deno task start fails on newly created project #265

Closed
mbhrznr opened this issue Jul 11, 2023 · 4 comments · Fixed by #266
Closed

deno task start fails on newly created project #265

mbhrznr opened this issue Jul 11, 2023 · 4 comments · Fixed by #266
Labels
bug Something isn't working

Comments

@mbhrznr
Copy link

mbhrznr commented Jul 11, 2023

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.

@mbhrznr
Copy link
Author

mbhrznr commented Jul 11, 2023

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

@deckchairlabs
Copy link
Member

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

@deckchairlabs
Copy link
Member

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

@mbhrznr
Copy link
Author

mbhrznr commented Jul 12, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants