Skip to content

[import/no-duplicates] false positive with .vue and .vue?raw imports #18655

@Armaldio

Description

@Armaldio

Description

The import/no-duplicates rule incorrectly reports duplicate imports when importing the same .vue file both normally and with a query parameter (e.g. ?raw).

Example:

import MyComponent from './MyComponent.vue';
import MyComponentRaw from './MyComponent.vue?raw';

This triggers import/no-duplicates, even though these imports have different purposes and semantics.

The rule seems to resolve both imports to the same file path and ignores query parameters.

Expected behavior

Imports with different query parameters should be treated as distinct modules, or the rule should provide an option to ignore query strings.

Example above should not be reported as a duplicate.

Actual behavior

The linter reports a duplicate import error.

Why this matters

Query-based imports (?raw, ?url, ?inline, etc.) are common in modern bundlers (Vite, Webpack, Rollup).

This makes the rule hard to use in real-world Vue/Vite projects without disabling it.

Possible solutions

  • Treat query parameters as part of the module identity.
  • Provide a configuration option to ignore/handle query strings.
  • Document this limitation clearly.

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions