New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

remix-mount-routes

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

remix-mount-routes

Package for mounting Remix routes to any path

  • 0.1.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
143
increased by5.15%
Maintainers
1
Weekly downloads
 
Created
Source

Remix Mount Routes

All Contributors

This package enables you to mount your Remix app at a different path than root.

🛠 Installation

> npm install -D remix-mount-routes

⚙️ Configuration

Update your remix.config.js file and use the custom routes config option.

Call mountRoutes(basePath, routesDir, ignoredRouteFiles?) and return the route manifest.

NOTE: basePath should be an absolute path (e.g., /myapp)

Your route files are still relative to app/routes folder. That is app/routes/posts/$slug.tsx will map to the URL /myapp/posts/:slug

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.

You can either hard-code the basePath in your config file, or use an environment variable like:

"build": "cross-env REMIX_BASEPATH=/myapp remix build",
"dev": "cross-env REMIX_BASEPATH=/myapp remix dev",
// remix.config.js
const { mountRoutes } = require('remix-mountroutes')

const basePath = process.env.REMIX_BASEPATH ?? ''

module.exports = {
  ignoredRouteFiles: ['.*'],
  publicPath: `${basePath}/build/`,
  assetsBuildDirectory: `public${basePath}/build`,
  routes: defineRoutes => mountRoutes('app', basePath, defineRoutes),
}

💡 Sample Web App

Here's a repo with a sample app mounted to /myapp

https://github.com/kiliman/remix-mount-routes-example

And here's the running app

https://remix-mount-routes-example.herokuapp.com

😍 Contributors

Thanks goes to these wonderful people (emoji key):


Kiliman

💻 📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Keywords

FAQs

Package last updated on 18 Mar 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc