Fix some CI (windows + nasm, core-macro error) (#2676)
* Moves index.html creation until after wasm creation so the webserver doesn't prematurely serve the page * sets up nasm for windows builds (to be superseded by Remove Dioxus CLI NASM dependency #2666 #2682) * puts magnanis-cli-support in a blocking task to prevent threadlocking during sequential builds * changes order of client/server builds such that the client is built before the server so the webserver doesn't prematurely serve invalid client code * declobbers "serve" such that each project gets a different dir in the target folder * uses nest_service instead of fallback so the router doesn't respond with fallback codes * reincorporates doge's fix from Fix hot-reloading on Windows #2544
This commit is contained in:
1 parent
40f936d56a
commit
8b5ad5d925
13 files changed
+55
-40
No files matched your search
@@ -45,16 +45,15 @@ use watcher::*;
|
||||
/// - I want us to be able to detect a `server_fn` in the project and then upgrade from a static server
|
||||
/// to a dynamic one on the fly.
|
||||
pub async fn serve_all(serve: Serve, dioxus_crate: DioxusCrate) -> Result<()> {
|
||||
let mut server = Server::start(&serve, &dioxus_crate);
|
||||
let mut watcher = Watcher::start(&dioxus_crate);
|
||||
let mut screen = Output::start(&serve)
|
||||
.await
|
||||
.expect("Failed to open terminal logger");
|
||||
let mut builder = Builder::new(&dioxus_crate, &serve);
|
||||
|
||||
// Start the first build
|
||||
builder.build();
|
||||
|
||||
let mut server = Server::start(&serve, &dioxus_crate);
|
||||
let mut watcher = Watcher::start(&dioxus_crate);
|
||||
let mut screen = Output::start(&serve).expect("Failed to open terminal logger");
|
||||
|
||||
loop {
|
||||
// Make sure we don't hog the CPU: these loop { select! {} } blocks can starve the executor
|
||||
yield_now().await;
|
||||
|
||||
@@ -86,7 +86,7 @@ enum Tab {
|
||||
type TerminalBackend = Terminal<CrosstermBackend<io::Stdout>>;
|
||||
|
||||
impl Output {
|
||||
pub async fn start(cfg: &Serve) -> io::Result<Self> {
|
||||
pub fn start(cfg: &Serve) -> io::Result<Self> {
|
||||
let interactive = std::io::stdout().is_tty() && cfg.interactive.unwrap_or(true);
|
||||
|
||||
let mut events = None;
|
||||
|
||||
@@ -328,13 +328,13 @@ fn setup_router(
|
||||
match platform {
|
||||
Platform::Web => {
|
||||
// Route file service to output the .wasm and assets if this is a web build
|
||||
router = router.fallback(build_serve_dir(serve, config));
|
||||
router = router.nest_service("/", build_serve_dir(serve, config));
|
||||
}
|
||||
Platform::Fullstack | Platform::StaticGeneration => {
|
||||
// For fullstack and static generation, forward all requests to the server
|
||||
let address = fullstack_address.unwrap();
|
||||
|
||||
router = router.fallback(super::proxy::proxy_to(
|
||||
router = router.nest_service("/",super::proxy::proxy_to(
|
||||
format!("http://{address}").parse().unwrap(),
|
||||
true,
|
||||
|error| {
|
||||
|
||||
Reference in new issue
Block a user