Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Add basename to remix config file #759

Closed
zachdtaylor opened this issue Nov 28, 2021 · 9 comments
Closed

[Feature]: Add basename to remix config file #759

zachdtaylor opened this issue Nov 28, 2021 · 9 comments
Labels
enhancement New feature or request feat:routing

Comments

@zachdtaylor
Copy link
Contributor

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 that basename prepended to them: https://discord.com/channels/770287896669978684/770287896669978687/914576247068188692. I think this is something we could add to the remix.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."

@satya-nutella
Copy link

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

@Vivalldi
Copy link

Vivalldi commented Dec 4, 2021

@meehawk , take a look at this line

let routes = createRoutes(build.routes);

createRoutes accepts a second parameter: parentId. I believe that's where you'd put a basename

@zachdtaylor
Copy link
Contributor Author

@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?

@satya-nutella
Copy link

@zachdtaylor I have started it. I wasn't sure if you're going to work on it. I'm really sorry 🥲

@zachdtaylor
Copy link
Contributor Author

@meehawk no worries, I should have left a comment saying that I was going to work on it

@yamidsumer
Copy link

Hello! This feature is very important to be able to use Remix in my company. Any news?

@machour machour added enhancement New feature or request feat:routing labels Mar 18, 2022
@kiliman
Copy link
Collaborator

kiliman commented Mar 18, 2022

@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.

@ngbrown
Copy link
Contributor

ngbrown commented Mar 18, 2022

@kiliman I noticed that the resources, such as the .js bundles, are still coming from the root /build location. I thought the idea for this issue was that the entire application can be configured to be hosted from any random virtual directory or sub-path above root on a server. That's at least how the linked issue #107 described it.

@kiliman
Copy link
Collaborator

kiliman commented Mar 18, 2022

It's mentioned in the README

Depending on your setup, you may also need to update publicPath and assetsBuildDirectory to include your basePath. This will ensure that your assets will be served properly.

module.exports = {
  ignoredRouteFiles: ['.*'],
  publicPath: `${basePath}/build/`,
  assetsBuildDirectory: `public${basePath}/build`,
  ...
}

@remix-run remix-run locked and limited conversation to collaborators Apr 19, 2022
@chaance chaance converted this issue into discussion #2891 Apr 19, 2022

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
enhancement New feature or request feat:routing
Projects
None yet
Development

No branches or pull requests

7 participants