I setup a project with parcel that with a preact app. When running the project with as dev with npm run dev (It allow me to test at http://localhost:8080).
When I access to http://localhost:8080 and click on My Profile link it works fine.
But when I build the project with npm run build (cf package.json) and serve the build file in dist/index.html and then I acces to http://localhost:8080/profile then the router is not working (404)
In all likelihood you haven't set up SPA routing in whatever server you're testing your built files in. You need to make sure all requests are redirected to /index.html.
I setup a project with parcel that with a preact app. When running the project with as dev with
npm run dev
(It allow me to test athttp://localhost:8080
). When I access tohttp://localhost:8080
and click onMy Profile
link it works fine.But when I build the project with
npm run build
(cf package.json) and serve the build file indist/index.html
and then I acces tohttp://localhost:8080/profile
then the router is not working (404)index.js
package.json
index.html