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

RedocStandalone component not rendering (whatwg-url does not provide an export named 'default') in DevMode #12425

Open
1 task
mr-t-Durden opened this issue Nov 13, 2024 · 5 comments
Labels
needs response Issue needs response from OP needs triage Issue needs to be triaged

Comments

@mr-t-Durden
Copy link

Astro Info

Astro                    v4.16.12
Node                     v20.11.0
System                   macOS (arm64)
Package Manager          yarn
Output                   static
Adapter                  none
Integrations             astro-expressive-code
                         @astrojs/mdx
                         @astrojs/sitemap
                         @astrojs/tailwind
                         astro-icon
                         @astrojs/react

If this issue only occurs in one browser, which browser is a problem?

No response

Describe the Bug

Trying to render the ReactStandalone component within a Astro project does not render the OpenAPI spec but shows the console error:

[astro-island] Error hydrating /src/components/Redoc.tsx SyntaxError: The requested module '/node_modules/whatwg-url/lib/public-api.js?v=0f68177f' does not provide an export named 'default' (at index.mjs?v=0f68177f:4:8)

This issue is exactly the same as in #6656 which had been solved via #6933.
Unfortunately there seem to be a different bug with Redoc #10815 which lead to reverting the fix in #10855 , which brings up the old error described above.

What's the expected result?

OpenApi Specs via RedocStandalone component does render properly within an Astro project.

Link to Minimal Reproducible Example

https://stackblitz.com/edit/withastro-astro-ekgxkc?file=package.json

Participation

  • I am willing to submit a pull request for this issue.
@github-actions github-actions bot added the needs triage Issue needs to be triaged label Nov 13, 2024
@ematipico
Copy link
Member

You might want to add the noExternal yourself. Does that fix the issue?

@ematipico ematipico added the needs response Issue needs response from OP label Nov 18, 2024
@mr-t-Durden
Copy link
Author

Hi @ematipico ,
thank you for your message.
I'm not sure how to test your proposal. Is this something I can setup in the Stackblitz Minimal Reproducible Example?

@ematipico
Copy link
Member

You'll have to update your astro.config.mjs like this:

defineConfig({
	vite: {
		ssr: {
			noExternal: ["redoc"]
		}
	}
})

I tried it with your stackblitz, and it worked for me

@mr-t-Durden
Copy link
Author

@ematipico Thank you for your explanations.
Unfortunately I just had reduced the Astro version during your try. Sorry for the confusion.
I updated to the latest version and applied your proposed changes. Unfortunately the error is still present running the dev command.

@mr-t-Durden mr-t-Durden changed the title RedocStandalone component not rendering (whatwg-url does not provide an export named 'default') RedocStandalone component not rendering (whatwg-url does not provide an export named 'default') in DevMode Nov 18, 2024
@mr-t-Durden
Copy link
Author

Jus to point this out: The build command is running through and renders the correct Redoc output.
Nonetheless not rendering with the dev command is a bit dangerous as one may fall into a pit trying to solve this during development, as I just did 😬
It would be great, if this could be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs response Issue needs response from OP needs triage Issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

2 participants