Skip to content

skipSelf behavior differs from rollup #13852

@ef4

Description

@ef4

Describe the bug

Rollup and Vite disagree on the precise semantics of the skipSelf option to this.resolve().

The Rollup docs say:

If you pass skipSelf: true, then the resolveId hook of the plugin from which this.resolve is called will be skipped when resolving. When other plugins themselves also call this.resolve in their resolveId hooks with the exact same source and importer while handling the original this.resolve call, then the resolveId hook of the original plugin will be skipped for those calls as well.

And that is the behavior we observe when using vite preview.

But in vite dev, skipSelf causes a plugin to be skipped during all recursive calls to this.resolve(), even when the source and importer are different.

Reproduction

https://stackblitz.com/edit/vitejs-vite-ftyzvj?file=vite.config.js

Steps to reproduce

In the Stackblitz reproduction, if you npm run dev the app will print "found second".

If you instead run npm run build && npm run preview, the app will print "found first".

System Info

Demonstrated on stackblitz using all the defaults provided by your blueprint.

Used Package Manager

npm

Logs

No response

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions