Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v1.2.1: CLI throws with ERR_REQUIRE_ESM from strip-ansi #27

Open
johnhunter opened this issue Jul 13, 2021 · 0 comments · May be fixed by #29
Open

v1.2.1: CLI throws with ERR_REQUIRE_ESM from strip-ansi #27

johnhunter opened this issue Jul 13, 2021 · 0 comments · May be fixed by #29

Comments

@johnhunter
Copy link

johnhunter commented Jul 13, 2021

Node: v14.16.1
eslint-parallel: 1.2.1

Caused by #25

Running eslint-parallel src/app/ --ext js
throws the following error:

internal/modules/cjs/loader.js:1080
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: node_modules/eslint-parallel/node_modules/strip-ansi/index.js
require() of ES modules is not supported.
require() of node_modules/eslint-parallel/node_modules/strip-ansi/index.js from node_modules/eslint-parallel/lib/formatter.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from [...]/node_modules/eslint-parallel/node_modules/strip-ansi/package.json.

Looks like the babel transformed eslint-parallel lib/formatter.js uses require and the strip-ansi module setting forbids it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant