Skip to content

Instantly share code, notes, and snippets.

@nandorojo
Last active April 22, 2024 10:00
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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:moti@0.18.0"
  }
}

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

Alternatively:

yarn add moti18@npm:moti@0.18.0

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