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

SolidJS: update docs for configuration #711

Closed
apatrida opened this issue Jul 5, 2024 · 21 comments · Fixed by #712
Closed

SolidJS: update docs for configuration #711

apatrida opened this issue Jul 5, 2024 · 21 comments · Fixed by #712
Assignees
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Milestone

Comments

@apatrida
Copy link

apatrida commented Jul 5, 2024

Describe the bug

Even using a sample quinoa-app, and doing something similar in a new app, all requests just end up redirecting to the Quarkus development UI, because there is no index.html in the /META-INF/resources directory. This is coded in Quarkus with no configuration option to disable it, and Quinoa does not override it.

It is also not clear if custom express middleware is needed as shown in the quinoa-codestart sample:

https://github.com/quarkiverse/quarkus-quinoa/blob/main/runtime/src/main/codestarts/quarkus/quinoa-codestart/base/src/main/webui/vite.config.js#L9

Create app with:

quarkus create app quinoa-app -x=io.quarkiverse.quinoa:quarkus-quinoa

And this only works on http://localhost:8080/quinoa.html and even if setting the SPA configuration to true still redirects to dev UI at http://localhost:8080/

quarkus.quinoa.enable-spa-routing=true

It just isn't clear how to get index.html working with something like Solid.js or even your sample working from index.html (other than quinoa.html)

And again, this create app has all the custom express handling which is not mentioned in the docs at all. Is it needed? not needed?

Regardless, can't get http://localhost:8080/ to work for the hosted webui

Quinoa version

2.4.1

Quarkus version

3.12.1

Build / Runtime

Vite

Package Manager

PNPM

Steps to reproduce the behavior

see above

Expected behavior

http://localhost:8080/ goes to the webui and not the quarkus dev ui

@apatrida
Copy link
Author

apatrida commented Jul 5, 2024

Is this needed?

%dev.quarkus.quinoa.dev-server.index-page=/

@apatrida
Copy link
Author

apatrida commented Jul 5, 2024

Ok, yes.

So, for Solid.js you need to set

%dev.quarkus.quinoa.dev-server.index-page=/

For it to override the index html redirect to /q/dev-ui

If you do not set the REST path for an /api such as:

quarkus.rest.path=/api

then you SHOULD set the following to avoid 404 in /api/whatever from going to the SPA

quarkus.quinoa.ignored-path-prefixes=/api

And if you want Quarkus to hit the 404 page, then don't set SPA mode, otherwise set SPA mode for the other paths in your app. Here I need to test more with a router, as currently I just created an empty solidjs app so far.

Might also need /q in the ignored path prefixes if SPA mode is on, to allow dev UI to show through.

@melloware
Copy link
Contributor

Hmm we should update the docs for solid but I know others are using solid without issue like this user: #705

@melloware
Copy link
Contributor

Oh that is you!

Make sure you check the docs about SPA.

@melloware
Copy link
Contributor

@melloware
Copy link
Contributor

But a PR would be great to update the docs we have other framework specific instructions we should add a Solid section here: https://docs.quarkiverse.io/quarkus-quinoa/dev/web-frameworks.html#_required_configuration

@melloware melloware added documentation Improvements or additions to documentation good first issue Good for newcomers labels Jul 6, 2024
@melloware melloware changed the title All requests just redirect to the quarkus developer UI SolidJS: update docs for configuration Jul 6, 2024
@apatrida
Copy link
Author

apatrida commented Jul 6, 2024

@melloware sure thing. Yet, the docs don't even mention this setting:

%dev.quarkus.quinoa.dev-server.index-page=/

Nor do the docs explain why the sample app has the express plugin in the vite config and which frameworks need it, or if only for "vite w/no framework". Since that is the sample application the product creates, and it is for no frameworks, it might confuse those using frameworks.

@melloware
Copy link
Contributor

melloware commented Jul 6, 2024

Isn't that documented right here: https://docs.quarkiverse.io/quarkus-quinoa/dev/config-reference.html#quarkus-quinoa_quarkus-quinoa-dev-server-index-page

Also i think the issue you are having is the CodeStart is just to show you how it works. You don't need anything in that package.json you would rip the whole web-ui out for your own project and its dependencies. Like from a Solid Start example.

For example I am using Farm in a React app with Quinoa here: https://github.com/melloware/quarkus-primereact

Take a look at my /webui/package.json it looks nothign like the codestart because i ripped out that starter project for my own entire web app.

@melloware
Copy link
Contributor

melloware commented Jul 6, 2024

Can you try this? Just unzip and run mvn quarkus:dev and hit localhost:8080.

This is a Solid app running under Quinoa:
quarkus-solidjs.zip

@apatrida
Copy link
Author

apatrida commented Jul 7, 2024

Set this value if the index page is different for the dev-server

what does "different" mean? it is the same for dev-server as production. But you have to set this setting because Quarkus thinks that if you do not have an index.html in the resources directory then you must want to go to the /q/ pages always. This has nothing to do with "if the index page is different for the dev-server".

This is a setting that must always be set for all frameworks, no? Other than the work around in the sample non-framework Vite app which tries to do this via an express plugin, but I don't think that works either.

If you go to http://localhost:8080 does it ever go to the SPA app for you? I would think not because of:

https://github.com/quarkusio/quarkus/blob/b8fbbed1bc265aec292ebc42a340622b237912be/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIProcessor.java#L252

and related:

https://github.com/quarkusio/quarkus/blob/b8fbbed1bc265aec292ebc42a340622b237912be/extensions/vertx-http/deployment/src/main/java/io/quarkus/devui/deployment/DevUIProcessor.java#L244

So isn't this setting REQUIRED in dev mode? maybe it should always be set to / in dev mode by Quinoa to override this redirect of dev UI pages.

@melloware
Copy link
Contributor

Did you try my Solid app above? It needs no custom props and works out of the box?

@apatrida
Copy link
Author

apatrida commented Jul 7, 2024

That solid-start app seems to behave better than the solid.js w/vite app that I was trying.

I upgraded to latest Quarkus 3.12.1, changed quarkus-resteasy-* to quarkus-rest for the renamming they did. Latest Quinoa of 2.4.1

I removed the SPA routing class work-around from that after upgrading as it seems to work fine without it.

That solid-start is very outdated, so will try with current as well, but need to replace the code as it has significant differences. But assuming it will work ok.

And correct, no custom props, works (the dev server must return better information than solidjs w/vite by itself was returning to block the /q/dev-ui redirect from index.html).

I'll try solid-start 1.0.2 which is current and report back.

@apatrida
Copy link
Author

apatrida commented Jul 7, 2024

Ok, solid-start 1.0.2 works fine without custom props, only SolidJS vite template doesn't.

I'm fine with that, I prefer solid-start.

BUT, there is one change needed for Solid-Start since 1.0.x or so, is that build outputs to .output and not to dist directory.

So this setting needed for current solid-start:

quarkus.quinoa.build-dir=.output

@apatrida
Copy link
Author

apatrida commented Jul 7, 2024

I'll post zip here in a moment, with modern Gradle, current everything, solid-start 1.0.2 build.

@apatrida
Copy link
Author

apatrida commented Jul 7, 2024

Here it is:
quarkus-quinoa-solidstart.zip

That is current quarkus, current quinoa, current Kotlin, current solid-start, current Gradle

thanks for your patience and help!

@apatrida
Copy link
Author

apatrida commented Jul 7, 2024

Links in that example to test:

Solid-Start app:

API:

DEV-UI:

@melloware
Copy link
Contributor

melloware commented Jul 7, 2024

Nice! Yeah the reason you have to use Solid Start its its a UI only library where Solid itself won't work because its serving its own pages and renderer. Quinoa only supports client side libraries and Solid i believe wants to be the HTTP server and render its pages.

@melloware melloware modified the milestones: 2.4.1, 2.4.2 Jul 7, 2024
melloware added a commit to melloware/quarkus-quinoa that referenced this issue Jul 7, 2024
@melloware melloware self-assigned this Jul 7, 2024
@melloware
Copy link
Contributor

See my PR: #712

Vinxi for Solid Start will need no custom configuration after that change

@apatrida
Copy link
Author

apatrida commented Jul 9, 2024

@melloware

Vinxi for Solid Start will need no custom configuration after that change

is .output not output for the build dir. when running pnpm build or vinxi build
It also creates .vinxi temporary directory as it stages the build.

Screenshot 2024-07-09 at 5 33 54 PM

dev mode is more silent, creates nothing that I know of.

@melloware
Copy link
Contributor

melloware commented Jul 9, 2024

Hmm ok let me look. .output is a weird choice by them.

@melloware
Copy link
Contributor

Ok fixed in master

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants