-
-
Notifications
You must be signed in to change notification settings - Fork 3
Description
Describe the bug
eslint-plugin-import
falsely reports a module resolution error when trying to import/require this module, because there is no 'main' field in package.json.
import-js/eslint-plugin-import#2132
Node.js docs suggest using the 'main' field for compatibility with older versions of build tools.
For projects using an older version of Node.js or a related build tool, compatibility can be achieved by including the "main" field alongside "exports" pointing to the same module
However, this happens even with the newest versions of eslint and its import plugin.
There is a workaround but it requires a change to the eslint config, which is not great:
settings: {
'import/resolver': [
path.resolve(__dirname, 'eslint-custom-resolver.cjs'),
'node',
],
},
Steps to reproduce
Try to import the package in a project that uses eslint
with eslint-plugin-import
.
Expected behavior
Importing/requiring this package does not cause issues with other tooling.
Screenshots and recordings
No response
Logs
error Unable to resolve path to module 'svg-chunk-webpack-plugin' import/no-unresolved
System Info
Node version: v22.14.0
npm packages:
- eslint
- eslint-plugin-import
Severity
Annoyance