Meteor auto-import uses file path instead of module path in disambiguation popup, but works correctly for unambiguous imports

WebStorm Bug Report: Meteor package auto-import uses file path instead of module path in disambiguation popup

Summary

When auto-importing a symbol that exists in multiple sources (ambiguous), the disambiguation popup shows the raw file path instead of the correct Meteor module path. However, when the symbol is unambiguous, auto-import correctly uses the Meteor module path.

Environment

  • WebStorm version: 2025.x (latest)
  • Meteor version: 3.0
  • OS: Arch Linux
  • TypeScript project with local Meteor packages

Project Structure

project/
├── packages/
│   └── my-utils-type/
│       ├── package.js
│       └── index.ts
├── imports/
│   └── app.js
└── tsconfig.json

Configuration

packages/my-utils-type/package.js:

Package.describe({
    name: 'my:utils-type',
    version: '1.0.0',
    summary: 'Type utilities'
});

Package.onUse(function(api) {
    api.versionsFrom('3.0');
    api.use(['ecmascript', 'typescript']);
    api.mainModule('index.ts', ['client', 'server']);
});

packages/my-utils-type/index.ts:

export function isString(value: unknown): value is string {
    return typeof value === 'string'
}

export function uniqueFunctionName(value: unknown): boolean {
    return true
}

tsconfig.json:

{
    "compilerOptions": {
        "module": "esnext",
        "allowSyntheticDefaultImports": true,
        "esModuleInterop": true,
        "moduleResolution": "node",
        "target": "es2018",
        "strict": true,
        "allowJs": true,
        "checkJs": false,
        "baseUrl": ".",
        "paths": {
            "/*": ["./*"],
            "meteor/my:*": [
                "packages/my-*/index.ts",
                "packages/my-*/index.js"
            ]
        }
    },
    "include": ["**/*.ts", "**/*.tsx", "**/*.js"]
}

Steps to Reproduce

Case 1: Unambiguous symbol (WORKS CORRECTLY)

  1. In any project file, type uniqueFunctionName() (a function that only exists in the local package)
  2. Press Alt+Enter or use the auto-import quick fix
  3. WebStorm correctly generates:

    import { uniqueFunctionName } from 'meteor/my:utils-type'
    

Case 2: Ambiguous symbol (BUG)

  1. In any project file, type isString() (a function that exists in both the local package and other libraries)
  2. Press Alt+Enter or use the auto-import quick fix
  3. The disambiguation popup appears showing:
    • Add import from "/packages/my-utils-type" ← INCORRECT
    • Add import from "other-library"
  4. Selecting the first option generates:

    import { isString } from '/packages/my-utils-type'
    

    instead of the correct:

    import { isString } from 'meteor/my:utils-type'
    

Expected Behavior

The disambiguation popup should show Add import from "meteor/my:utils-type" and generate the import using the mapped module path, consistent with the unambiguous case.

Actual Behavior

The disambiguation popup shows the raw file path /packages/my-utils-type and generates an incorrect import that doesn't use the tsconfig path mapping.

Analysis

WebStorm correctly uses tsconfig path mappings when generating imports for unambiguous symbols, but the disambiguation popup code path does not apply the same reverse path mapping logic. This is an inconsistency within the auto-import feature.

Related Issues

  • WEB-21682: Meteor package import resolution
  • WEB-21901: Suggest ES6 imports for meteor package exports

Impact

This forces developers to manually correct imports every time they auto-import a commonly-named function from a local Meteor package, significantly reducing productivity.

0
1 comment

After detailed consideration, we have decided to discontinue support for the Meteor plugin. Unfortunately, allocating resources to its maintenance is not feasible for us. The plugin is now open source to allow community to continue its development.

0

Please sign in to leave a comment.