sveltejs / rollup-plugin-svelte

Compile Svelte components with Rollup
MIT License
505 stars 79 forks source link

(!) Plugin commonjs--resolver: It appears a plugin has implemented a "resolveId" hook that uses "this.resolve" without forwarding the third "options" parameter of "resolveId" #207

Closed josdejong closed 1 year ago

josdejong commented 1 year ago

After upgrading from 7.1.2 to 7.1.3 I get the following warning when using rollup:

(!) Plugin commonjs--resolver: It appears a plugin has implemented a "resolveId" hook that uses "this.resolve" without forwarding the third "options" parameter of "resolveId". This is problematic as it can lead to wrong module resolutions especially for the node-resolve plugin and in certain cases cause early exit errors for the commonjs plugin. In rare cases, this warning can appear if the same file is both imported and required from the same mixed ES/CommonJS module, in which case it can be ignored.

I'm not sure if this is caused by rollup-plugin-svelte itself or a side effect from an other plugin. Any idea how to pinpoint this? Can it be casused by this commit https://github.com/sveltejs/rollup-plugin-svelte/commit/3be2d583515f2c63d43385179339946178563bd7?

dummdidumm commented 1 year ago

Yeah it's probably from that commit - I'm not sure how to work around this / how to silence the warning because it's essentially a false positive

josdejong commented 1 year ago

Probably,

async resolveId(importee, importer) {
  // ...
  const resolved = await this.resolve(importee, importer, { skipSelf: true });
  //...
}

Should be changed to something like:

async resolveId(importee, importer, options) {
  // ...
  const resolved = await this.resolve(importee, importer, { skipSelf: true, ...options });
  //...
}

EDIT: for reference, see https://github.com/lightyen/typescript-paths/issues/3