Skip to content
| Marketplace
Sign in
Visual Studio Code>Programming Languages>PWA Kit Multiple DefinitionsNew to Visual Studio Code? Get it now.
PWA Kit Multiple Definitions

PWA Kit Multiple Definitions

allracs

|
24 installs
| (0) | Free
Go to Declaration support for Salesforce Commerce Cloud PWA Kit projects — resolves @salesforce/retail-react-app aliases to actual files in app/ and custom/ override folders.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

PWA Kit Multiple Definitions

Lightweight VS Code extension that brings "Go to Declaration" / "Go to Definition" behavior for Salesforce Commerce Cloud PWA Kit projects.

It resolves imports that use the @salesforce/retail-react-app alias to actual files in the project app/ and custom/*/ override folders and supports symbol-level navigation (jump to the exported variable/function/class inside the target file).

Features

  • Resolve @salesforce/retail-react-app/... aliased imports to real files under app/ and custom/*/.
  • Symbol-level navigation: when you jump on an imported symbol (or a usage of it), the extension navigates to the exported declaration inside the resolved file.
  • Works for common JS/JSX export forms: export const, export [async] function, export class, export { ... } (including multi-line lists and X as default), export default, and CommonJS module.exports.
  • Understands multi-line imports, namespace imports (import * as x), export ... from re-exports and dynamic import() (e.g. inside loadable()).
  • No heavy AST dependencies — small, fast, regex-based implementation targeting JS/JSX projects.

Usage

  • Open a file in your PWA Kit project that imports from @salesforce/retail-react-app/....
  • Cmd+Click (macOS) / Ctrl+Click or press F12 on either:
    • an import statement, on any of its lines (e.g. import { useMyCustomHook } from '@salesforce/...';) or
    • a usage of the imported symbol (e.g. useMyCustomHook({...})).
  • The extension resolves the alias to app/ and any custom/*/ override folders and navigates to the exported declaration (when available). If the symbol cannot be resolved, the extension falls back to opening the target file.

How it works

  • Alias resolution: the extension scans {workspaceRoot}/custom/ for subfolders and builds alias prefixes such as:
    • @salesforce/retail-react-app/app/
    • @salesforce/retail-react-app/custom/<name>/
  • When resolving an import path it strips the matching alias prefix to get a relative path and then tries to locate files in this order:
    1. exact path (file)
    2. path.jsx
    3. path.js
    4. if directory: index.jsx
    5. if directory: index.js
  • The resolver searches app/ first, then each custom/<name>/ folder and returns all matching targets (so you can jump to overrides as well as upstream files). The file you are in is left out, since an override importing its base would otherwise list itself.
  • Other @salesforce/retail-react-app/... paths (e.g. config/...) resolve against the project root.
  • Symbol-level navigation: after locating the candidate files, the extension scans the target file(s) for exported symbols using simple, robust regular expressions that match common export forms (export const, export function, export { ... }, export default). If the symbol is found, the extension returns a Location pointing to the line/character of the export.

Limitations

  • JS/JSX only — this implementation intentionally does not parse TypeScript files.
  • Parsing is regex-based and covers the common export/import shapes used in PWA Kit; very unusual or minified forms may not be recognized.
  • The project root is the nearest folder above the current file that has both a package.json and an app/ folder (falling back to the workspace folder), so monorepos and parent folders work. Nested PWA Kit projects inside one another are not supported.

Contact

If you want help or want to collaborate, open an issue or a PR in the repository.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft