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

Add redirection helper for vite #1410

Open
Jand42 opened this issue Jun 11, 2024 · 1 comment
Open

Add redirection helper for vite #1410

Jand42 opened this issue Jun 11, 2024 · 1 comment

Comments

@Jand42
Copy link
Member

Jand42 commented Jun 11, 2024

A debug-oriented middleware to use readable WebSharper outputs through vite:

            .Use(fun context (next: RequestDelegate) ->
                if context.Request.Path.StartsWithSegments("/Scripts") || context.Request.Path.StartsWithSegments("/@vite") then
                    let proxyRequest = context.Request.Path.Value
                    context.Response.Redirect($"http://localhost:5173{proxyRequest}")
                    Task.CompletedTask
                else
                    next.Invoke(context)
            )

Adding this as .UseWebSharperScriptRedirect() which can take redirect url from appsettings.Development.json (or possibly directly from an optional arg), but defaults to the one above (default for vite)

@granicz
Copy link
Member

granicz commented Jun 11, 2024

This would be a good time to add support for a webpack dev server in the config file too. Something like:

debug.server=vite|webpack, and debug.rewriteUrl=...

Jand42 added a commit that referenced this issue Jun 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants