[How To] Customize rollup config in Frappe

Is it possible to js code in typescript by customizing rollup config??
Any suggestions would be really helpful.

I managed to add Angular with this workaround,

@revant_one thanks for your comment:

The downside of the approach mentioned is that it does not reuse the frappe framework codebase like the dialogs and frappe-js etc.
I have to come to like the zero-config plug and play nature of frappe apps.

I have done some work over the new year’s free time and was able to run parcel and react/vue together.

My motivation eventually being able to write React/Vue code and have server-rendered SPA apps built using them.

Much similar to https://remix.run/
Completed:

  • App compiling and module resolution
  • Component isolation using web components

Currrently working on:

  • Good system to server render react/vue code
  • Routing changes for client side routing for portal pages

Suggestions are welcome :slight_smile:

Check updates on rebrand-ui branch

I think it has updated client side routing

1 Like

@revant_one can you help with where exactly the client side routing is implemented ? :sweat_smile:

I’m trying to get React Router to work with frappe webpage.

For now React Router works, navigating to and from works, but if i refresh the page then it gives me a 404. because frappe takes over page reloads

UPDATE:

I;m stupid, this did it

website_route_rules = [
	{"from_route": "/hemlo/about", "to_route": "/hemlo"},
	{"from_route": "/hemlo/about/deep", "to_route": "/hemlo"},
]

but now i have to map each route back to hemlo, is there any way to not write a big list of routes? and just do /hemlo/* to /hemlo route rule?

UPDATE:

/hemlo/about/deep is working just fine on refresh

BUT /hemlo/about/ is giving TOO MANY REDIRECTS

HTTP/1.0 301 MOVED PERMANENTLY
 -> Location: http://localhost:8002/hemlo/about
HTTP/1.0 301 MOVED PERMANENTLY
 -> Location: http://localhost:8002/hemlo/about
HTTP/1.0 301 MOVED PERMANENTLY
 -> Location: http://localhost:8002/hemlo/about
HTTP/1.0 301 MOVED PERMANENTLY
 -> Location: http://localhost:8002/hemlo/about
HTTP/1.0 301 MOVED PERMANENTLY
 -> Location: http://localhost:8002/hemlo/about

what am i doing wrong ?

UPDATE:

I changed my routes to this

website_route_rules = [
	{"from_route": "/hemlo/another", "to_route": "/hemlo"},
	{"from_route": "/hemlo/another/deep", "to_route": "/hemlo"},
]

And everything works exactly how i want ! :slight_smile:

So it turns out if there’s about in the url then frappe will try to redirect it to the about webpage, and it ends up in a loop.

Simply NOT using about fixed it, i replaced about with another

1 Like