You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've got a new project going, where I'm experimenting with the new FlatConfig option.
Trying to import eslint-import-resolver-typescript into the config file results in the following error:
Uncaught exception received.
file:///C:/Users/scrap/Reps/MiaTickets-API/node_modules/eslint-import-resolver-typescript/lib/index.js:5
import { CachedInputFileSystem, ResolverFactory, } from 'enhanced-resolve';
^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'CachedInputFileSystem' not found. The requested module 'enhanced-resolve' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'enhanced-resolve';
const { CachedInputFileSystem, ResolverFactory, } = pkg;
This seems to be due to enhanced-resolve being CommonJS. My project is written with ES Modules, essentially breaking this package.
As a temporary workaround, I've gone back to importing eslint-plugin-import, accepting the lack of type information.
To make this work, however, it's apparently needed to add this little line to the settings object:
I've found this little line of code also helps a great deal, making my previous workaround suggestion of setting "espree" in the parsers option completely redundant..
I've got a new project going, where I'm experimenting with the new FlatConfig option.
Trying to import
eslint-import-resolver-typescript
into the config file results in the following error:This seems to be due to
enhanced-resolve
being CommonJS. My project is written with ES Modules, essentially breaking this package.As a temporary workaround, I've gone back to importing
eslint-plugin-import
, accepting the lack of type information.To make this work, however, it's apparently needed to add this little line to the settings object:
The text was updated successfully, but these errors were encountered: