import-js/eslint-plugin-import

Cannot resolve `const [imagemin, webp] = await Promise.all([import('imagemin'), import('imagemin-webp')]);`

adamlui opened this issue · 5 comments

https://github.com/adamlui/js-utils/blob/23b8bbb60944f8207e9793ad3ec021ffedb39f9e/img-to-webp/img-to-webp.js#L18C1-L18C94 results in

Error:   18:55  error  Unable to resolve path to module 'imagemin'       import/no-unresolved
Error:   18:75  error  Unable to resolve path to module 'imagemin-webp'  import/no-unresolved
ljharb commented

Are these packages installed locally?

Indeed they are via package.json dependencies

...
  "dependencies": {
    "imagemin": "^9.0.0",
    "imagemin-webp": "^8.0.0"
  }
...
ljharb commented

The issue then, seems to be that both of these packages lack a main, and use type: module, and this package doesn't support the exports field yet.

I'd suggest putting them in import/ignore in the meantime.

I already did but maybe you should add a feature to auto-detect unsupported pkg types to not false positive in the meantime for better UX

ljharb commented

Due to the way resolvers are implemented, that would probably take almost as much time as the support itself.