Skip to content

Instantly share code, notes, and snippets.

@nandorojo
Last active May 4, 2024 23:15
Show Gist options
  • Save nandorojo/1b969a0d88cf81ca8a2a334a5bd2ee4a to your computer and use it in GitHub Desktop.
Save nandorojo/1b969a0d88cf81ca8a2a334a5bd2ee4a to your computer and use it in GitHub Desktop.
How to rename an NPM package in your `package.json`

Add the package name you want to your package.json dependencies, and then make the value npm:<actual-package-name>. You can also add a version to the end.

package.json

{
  "dependencies": {
    "moti18": "npm:[email protected]"
  }
}

This will install moti at version 0.18.0, and rename it to moti18.

Alternatively:

yarn add moti18@npm:[email protected]

You can now import from the renamed package:

import { MotiView } from 'moti18'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment