eslint-plugin-import icon indicating copy to clipboard operation
eslint-plugin-import copied to clipboard

`import/no-unresolved` triggers when importing `pixi.js/advanced-blend-modes`.

Open guillaumebrunerie opened this issue 1 year ago • 3 comments

With PixiJS v8, advanced blend modes are imported as follows (see for instance https://pixijs.com/8.x/examples/basic/blend-modes):

import "pixi.js/advanced-blend-modes";

However, this triggers the lint error Unable to resolve path to module 'pixi.js/advanced-blend-modes'. [import/no-unresolved].

Here is the (I think) relevant part of PixiJS's package.json (seems correct to me, but I don’t know much about those things):

{
  "exports": {
    "./advanced-blend-modes": {
      "import": {
        "default": "./lib/advanced-blend-modes/init.mjs"
      },
      "require": {
        "default": "./lib/advanced-blend-modes/init.js"
      }
    }
  }
}

Note that if I write the following:

import "pixi.js/lib/advanced-blend-modes";

then the lint error goes away, but the import itself doesn’t work anymore, I get the following error from Vite:

[plugin:vite:import-analysis] Missing "./lib/advanced-blend-modes" specifier in "pixi.js" package

I'm not sure if it’s an issue in eslint-plugin-import, in PixiJS, or if I misconfigured something? I’m using ESLint 8.57 with a .eslintrc and "type": "module" in my package.json.

guillaumebrunerie avatar Oct 20 '24 18:10 guillaumebrunerie