Package Alias: Multiple versions of npm package

When you are working on a module/plugin and want to make sure that they work with all versions, you can work with a custom alias.

Table of Contents

Custom Alias

npm i <your-alias>@npm:<package-name>

Specific Version

You can also install a specific version of the package by appending the command with @<package-version>.

npm i astro-v1@npm:astro@1
npm i astro@npm:astro

Import usage:

// astro-v1
import { defineConfig } from "astro-v1/config";
// astro
import { defineConfig } from "astro/config";