Allow for dynamic import() to be used in eslint config file
See original GitHub issueThe version of ESLint you are using.
ESLint-v7.8.1
The problem you want to solve.
Currently, while eslint understands the meaning of the .cjs
extension, it is unable to load a config file that uses dinamic import()
statements. It fails with an error:
TypeError [ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING]: A dynamic import callback was not specified.
This is caused by the dependency v8-compile-cache
which patches the node internal Module.prototype._compile
method in an insufficient fashion.
The purpouse of solving this is easier handeling of eslint configs for esm-users until config-file-simplification
arrives (RFC). The Roadmap estimated the implementation to arrive in 5 months (6 months when the statement was made).
Your take on the correct solution to problem.
As the problem is caused by a dependency, there is no straight forward solution. I’ll file an issue in in the project after i’m done here. issue filed
NOTE: While debugging the issue, I found some things that are potential road-blocks for esm support (like the dependency import-fresh
, which dispite the name is for loading cjs). I’ll be doing some more exploring and will post a proper report (propaby in the RFC repo) once i have some spare time.
Are you willing to submit a pull request to implement this change?
Potentially. I’ll check what exactly would need to have to change in v8-compile-cache
and possibly make a PR there to solve the problem at the root. Besides that, it depends on what I find while examining the things mentioned in the note.
NOTE: A quick-fix is setting the env-variable DISABLE_V8_COMPILE_CACHE
Issue Analytics
- State:
- Created 3 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
Here’s how to import ES Modules in a synchronous way:
See
deasync
Running with
DISABLE_V8_COMPILE_CACHE=1 eslint .
works great!Awesome, thanks for sharing this!