Registry / devops / react-router-migration-helper

react-router-migration-helper

JSON →
library1.0.5jsnpmunverified

A CLI tool and library for migrating React Router v3 route configurations to v4. Version 1.0.5 is the latest and stable, with no recent updates since 2019. It converts JSX-based route definitions into a JSON object compatible with React Router v4's new declarative routing model. Unlike manual migration scripts, this tool automates the conversion of static routes, index routes, and nested routes. However, it does not handle dynamic routes (splat) or base URL replacements, as noted in its TODO. The package is no longer actively maintained and should be considered a one-time migration helper rather than a long-term dependency.

npm install react-router-migration-helper
INSTALL
IMPORT
SIG · REACT-ROUTER-MIGRA
R
react-router-migration-helper
devopsjavascriptv1.0.5
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import migrate from 'react-router-migration-helper'
const migrate = require('react-router-migration-helper')
The package exports a function, not an object. CommonJS require works, but ESM import is preferred for clarity.
migrate
import migrate from 'react-router-migration-helper'
import { migrate } from 'react-router-migration-helper'
The default export is a function named 'migrate'; named import will fail.
CLI command
npx rrm ./router.js
rrm ./router.js (without global install)
The CLI command is 'rrm'. If not globally installed, use npx or npm script.

Shows two ways to use the package: CLI command for quick migration and programmatic API for custom integration.

// Install globally npm install -g react-router-migration-helper // Run migration rrm ./router.js // Output written to result.js // Or use programmatically import migrate from 'react-router-migration-helper'; import fs from 'fs'; const code = fs.readFileSync('./router.js', 'utf8'); const result = migrate(code); console.log(result);
Debug
Known issues
deprecatedPackage is no longer maintained. React Router v3 to v4 migration is outdated; use other tools for v5/v6.
fix
Consider using 'react-router-codemod' or manual migration for newer React Router versions.
affects: >=1.0.0
gotchaCLI command 'rrm' can be misspelled as 'rm', causing accidental file deletion.
fix
Always double-check the command before executing. Use 'npx rrm' to avoid risks.
affects: >=1.0.0
gotchaDoes not handle splat routes (e.g., *) or base URL replacements as per the TODO list.
fix
Manually update those patterns after migration.
affects: >=1.0.0
Errors
Common errors & fixes
Cannot find module 'react-router-migration-helper'
Package not installed locally or globally when using require/import.
fix
Install the package: npm install react-router-migration-helper
TypeError: migrate is not a function
Incorrect named import instead of default import.
fix
Use default import: import migrate from 'react-router-migration-helper'
Error: ENOENT: no such file or directory, open './router.js'
File path provided to CLI does not exist.
fix
Verify the file path and provide an absolute path or correct relative path.
Upgrade
Version history
1.0.5latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
15 hits · last 30 days
node
14
Amazon
1
Resources
react-router-migration-helper — npm install react-router-migration-helper · libregistry