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

ERROR import {sync as globSync} from 'fast-glob'; #238

Closed
GollyJer opened this issue Aug 26, 2023 · 3 comments · Fixed by #241
Closed

ERROR import {sync as globSync} from 'fast-glob'; #238

GollyJer opened this issue Aug 26, 2023 · 3 comments · Fixed by #241

Comments

@GollyJer
Copy link

After installing in my project ESLint is now throwing this error.

I haven't ever had anything like this with plugins.
How do I troubleshoot? Thanks.

Uncaught exception received.
file:///Users/jeremy/dev/__active/eslint-plugin-awesome-labs/node_modules/eslint-import-resolver-typescript/lib/index.js:6
import { sync as globSync } from 'fast-glob';
         ^^^^
SyntaxError: Named export 'sync' not found. The requested module 'fast-glob' 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 'fast-glob';
const { sync: globSync } = pkg;
@klippx
Copy link
Contributor

klippx commented Sep 21, 2023

This is likely due to your project being ESM, and this project is also ESM, but is importing an CJS package here:

import { sync as globSync } from 'fast-glob';

which doesn't work.

The fix is easy:

import FastGlob from 'fast-glob';
const { sync: globSync } = FastGlob;

@JounQin
Copy link
Collaborator

JounQin commented Sep 21, 2023

PR welcome.

@klippx
Copy link
Contributor

klippx commented Sep 21, 2023

Ok, np. PR is up but your CI is broken.

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

Successfully merging a pull request may close this issue.

3 participants