You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm using Remix to develop a Shopify app, and the app runs in two different environments:
Embedded in Admin panel through an iframe
Directly injected into customers store code via proxy
When the app runs in admin, the default / basepath is fine, but I want the proxy to be directed to a different set of routes than the admin: /app/my-app -> /proxy. So the index page for the proxied par of the app would be /proxy routes. So the issues is this:
The Scripts/Links components don't account for the proxy url, meaning they will be similar to this ./app/proxy/index.ts rather than /app/my-app/app/proxy/index.ts. To solve this I would need to be able to provide the prefix/basepath to use for Scripts/Links at runtime.
I need to be able to switch back to / as basepath in case of admin panel (I can detect proxy usage, it's ok)
I tried hacking together a solution by effectively forking Scripts/Links components and changing relevant bits similar to this discussion: #6075
However, it's become a lot harder to do now that Vite has been introduced, as it's using its own basepath config for dev server to serve assets from node_modules and stuff like @id/__x00__virtual:remix/browser-manifest.
Is there any solution to this currently? My only alternative at the moment seems to be to direct proxy to base / and conditionally render different route code, but that's going to get messy very quickly.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm using Remix to develop a Shopify app, and the app runs in two different environments:
When the app runs in admin, the default
/
basepath is fine, but I want the proxy to be directed to a different set of routes than the admin:/app/my-app
->/proxy
. So the index page for the proxied par of the app would be/proxy
routes. So the issues is this:./app/proxy/index.ts
rather than/app/my-app/app/proxy/index.ts
. To solve this I would need to be able to provide the prefix/basepath to use for Scripts/Links at runtime./
as basepath in case of admin panel (I can detect proxy usage, it's ok)I tried hacking together a solution by effectively forking Scripts/Links components and changing relevant bits similar to this discussion: #6075
However, it's become a lot harder to do now that Vite has been introduced, as it's using its own basepath config for dev server to serve assets from node_modules and stuff like
@id/__x00__virtual:remix/browser-manifest
.Is there any solution to this currently? My only alternative at the moment seems to be to direct proxy to base
/
and conditionally render different route code, but that's going to get messy very quickly.Beta Was this translation helpful? Give feedback.
All reactions