exhibitionist-digital / ultra

Zero-Legacy Deno/React Suspense SSR Framework
https://ultrajs.dev
MIT License
2.99k stars 65 forks source link

build react-router project: nested path routes like /table/countries are not supported in browser #291

Open d9k opened 6 months ago

d9k commented 6 months ago
      <Routes>
            <Route
              element={<TablePage />}
              path='table/:name'
            />
    </Routes>
deno task build
cd .ultra
deno task start

Then open https://localhost:8000/table/countries.

Result: multiple

Failed to load module script: Expected a JavaScript module script but the server responded with a MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.

errors in browser.

d9k commented 6 months ago

Can't reproduce: minimal example works fine

https://github.com/d9k/d9k-problems-examples/tree/main/deno/ultra/291-nested-path-routes

Closing issue for now.

d9k commented 6 months ago

Reproduced on https://github.com/d9k/d9k-problems-examples/tree/main/deno/ultra/291-nested-path-routes

Selection_2023-12-29_09-16-43

Added component with relative import:

import { useParams } from 'react-router-dom';
import { Spinner } from "../components/spinner.tsx";

function PageNestedDemo () {
  const name = useParams()['name'];

  return (
    <>
      <h1>Nested demo page</h1>

      <p>Url param :name value is "{name}"</p>

      <Spinner />
    </>
  );
}

export default PageNestedDemo;