eslint-plugin-require-extensions icon indicating copy to clipboard operation
eslint-plugin-require-extensions copied to clipboard

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined

Open raine opened this issue 1 year ago • 1 comments

With npx @eslint/migrate-config .eslintrc.json migrated my config to eslint.config.js for eslint v9 and got:

ESLint: 9.13.0

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /node_modules/eslint-plugin-require-extensions/package.json imported from eslint.config.mjs
    at exportsNotFound (node:internal/modules/esm/resolve:296:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:586:13)
    at packageResolve (node:internal/modules/esm/resolve:823:14)
    at moduleResolve (node:internal/modules/esm/resolve:907:18)
    at defaultResolve (node:internal/modules/esm/resolve:1037:11)
    at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:650:12)
    at #cachedDefaultResolve (node:internal/modules/esm/loader:599:25)
    at ModuleLoader.resolve (node:internal/modules/esm/loader:582:38)
    at ModuleLoader.getModuleJobForImport (node:internal/modules/esm/loader:241:38)
    at ModuleJob._link (node:internal/modules/esm/module_job:132:49)

For now solved with:

import { createRequire } from "module"
const require = createRequire(import.meta.url)
const requireExtensions = require("eslint-plugin-require-extensions")

raine avatar Oct 20 '24 20:10 raine

@raine I've published a new package eslint-plugin-import-extensions

brianwestphal avatar Mar 25 '25 03:03 brianwestphal