NPM Package Viewer

April 6, 2026 ยท View on GitHub

Open npm package pages directly from your import statements โ€” in your default browser or inside VS Code.

Features

๐Ÿ“ฆ Context Menu & Commands

Right-click on any import line to access the NPM Package Viewer submenu:

  • Open npm Page in Browser โ€” Opens the package on npmjs.com in your default browser
  • Open npm Page in VS Code โ€” Opens the package page in an embedded VS Code browser tab
  • Go to package.json Dependency โ€” Jumps to the package entry in your project's package.json

All commands are also available via the Command Palette (Ctrl+Shift+P / Cmd+Shift+P).

๐Ÿ” CodeLens

Inline "Open on npm โ†—" and "View in VS Code" links appear above every import statement. Node.js built-in modules are labelled accordingly.

๐Ÿ’ฌ Hover Information

Hover over any import to see the package name with quick-action links.

๐Ÿ“Š Status Bar

The current package name is shown in the status bar when your cursor is on an import line. Click it to open the package.

๐Ÿง  Smart Module Detection

  • Supported syntaxes: ESM import, CommonJS require(), dynamic import(), re-exports export ... from
  • Multi-line imports: Resolves the module name even when the cursor is inside a multi-line import block
  • Scoped packages: Handles @scope/package and deep imports like lodash/fp
  • Graceful classification:
    • Node.js built-ins (node:fs, path) โ†’ informational message
    • Relative imports (./utils) โ†’ informational message
    • TypeScript path aliases (from tsconfig.json paths) โ†’ informational message
    • Everything else โ†’ opens on npm

Supported Languages

  • JavaScript (.js)
  • TypeScript (.ts)
  • JSX (.jsx)
  • TSX (.tsx)

Supported Import Syntaxes

SyntaxExample
ESM default importimport lodash from "lodash"
ESM named importimport { useState } from "react"
ESM namespace importimport * as fs from "node:fs"
ESM side-effect importimport "reflect-metadata"
ESM type importimport type { FC } from "react"
Dynamic importconst m = await import("chalk")
CommonJS requireconst express = require("express")
Re-exportexport { foo } from "bar"

Configuration

SettingDefaultDescription
npmPackageViewer.defaultAction"browser"Default action: "browser" or "webview"
npmPackageViewer.registryUrl"https://www.npmjs.com"Base URL of the npm registry to link to
npmPackageViewer.showCodeLenstrueShow CodeLens above import lines
npmPackageViewer.showHovertrueShow hover information on import lines
npmPackageViewer.showStatusBarItemtrueShow package name in the status bar

License

MIT