[Feature]: Add basename
to remix config file
#2891
Replies: 16 comments 11 replies
-
Not sure if this feature is in plans but it sounds very useful. I'd love to work on this. I'm new to Remix and any guidance would be awesome |
Beta Was this translation helpful? Give feedback.
-
@meehawk , take a look at this line
|
Beta Was this translation helpful? Give feedback.
-
@meehawk Sorry I didn't see this sooner. Been on vacation the last few days. I was planning on doing this but have you already started? |
Beta Was this translation helpful? Give feedback.
-
@zachdtaylor I have started it. I wasn't sure if you're going to work on it. I'm really sorry 🥲 |
Beta Was this translation helpful? Give feedback.
-
@meehawk no worries, I should have left a comment saying that I was going to work on it |
Beta Was this translation helpful? Give feedback.
-
Hello! This feature is very important to be able to use Remix in my company. Any news? |
Beta Was this translation helpful? Give feedback.
-
@yamidsumer I created a package that will let you mount routes from any folder to any base path Here's a sample site: https://remix-mount-routes-example.herokuapp.com/ It has links to the package repo and example repo. |
Beta Was this translation helpful? Give feedback.
-
@kiliman I noticed that the resources, such as the |
Beta Was this translation helpful? Give feedback.
-
It's mentioned in the README
module.exports = {
ignoredRouteFiles: ['.*'],
publicPath: `${basePath}/build/`,
assetsBuildDirectory: `public${basePath}/build`,
...
} |
Beta Was this translation helpful? Give feedback.
-
I've been trying to hack this in to remix over the weekend. It's really difficult without some more experience (of which I have none). I'll outline some requirements and what areas I think need updating and hopefully some of the maintainers can chime in with some opinions. Potentially I can champion an RFC if that's of interest. MotivationNot all applications are hosted on the root of the domain, so instead of
Checking discord and github yields a decent interest in this capability. There is prior art available from next https://nextjs.org/docs/api-reference/next.config.js/basepath and gatsby https://www.gatsbyjs.com/docs/how-to/previews-deploys-hosting/path-prefix/ that also back up the claims of desirability. WorkaroundsRight now it should be possible to host remix on a path using the Some suggestions from @ryanflorence here that revolve around adding a fixed basePath in the routes directory, like Even then it's my understanding that absolute references would be totally broken if the intention is to link to the root of the remix application, instead it would point to the root of the domain. For example Possible solutionAdd a What I've triedMy experience with remix is extremely limited so take that into consideration when reading the following
It would be awesome if the community can validate what I've put here, @kiliman you seem like a trailblazer in this space already. Specifically if we can work out all the edge cases it would be much easier to take forward as an RFC. |
Beta Was this translation helpful? Give feedback.
-
Hello, I have server:
I used your library to be able to host page on path I know I can remove form all places '/' sign, but I am not sure if it is a good idea, Do you have any recomendation about it? |
Beta Was this translation helpful? Give feedback.
-
Hi, The main changes are:
|
Beta Was this translation helpful? Give feedback.
-
I have a slightly different use case I think. We have an app that needs to be able to serve content on a (potential) dynamic basename. Currently we’re fetching a config pre-remix based on request headers, in said config there’s an entry which later determines the current basename. All content and styles in the application is based on this config. To enable this we have the following structure:
I think this is fine, but it assumes our this application is having a basename set, which is not the case at all times. In that case we'd want to serve the application from root. This seems to be working, but feels a bit hacky, any other clever alternatives to this that we may have missed? If not I'm mostly requesting the option to add a basename to the context passed to RAS, in order for us to continue to use the Link component from remix and not to have our custom one that appends potential basename. Also, if I keep state in the url, I'd like to keep current locale in the url aswell (which is alot like what I'm requesting). Thanks! |
Beta Was this translation helpful? Give feedback.
-
Hi I was wondering if there were any further thoughts/development on this. I'm looking to deploy an app on the url I also found |
Beta Was this translation helpful? Give feedback.
-
Remix is pretty slick. 💙 Major props on the ease of custom SSR setup, and mad brownie points for, ya know, not being Vercel! But… For a framework that makes a big deal of being backed by React Router and claims that “you can use all [of its] features…in your Remix app”, this issue is a showstopper. We use the Honestly, it’s too bad; I’d’ve loved to use Remix! 😭 |
Beta Was this translation helpful? Give feedback.
-
This has been added to our Vite plugin in #8145. It'll be out in the next release. |
Beta Was this translation helpful? Give feedback.
-
What is the new or updated feature that you are suggesting?
Somebody in discord asked if he could set a
basename
for a Remix app, so all routes would have thatbasename
prepended to them: https://discord.com/channels/770287896669978684/770287896669978687/914576247068188692. I think this is something we could add to theremix.config.js
file.Why should this feature be included?
This would allow more flexibility in configuring a Remix app, giving more power to the developer a la "you own your stack."
Beta Was this translation helpful? Give feedback.
All reactions