Skip to content

fix: use namespace import for glob package#959

Closed
aleclarson wants to merge 1 commit intomicrosoft:mainfrom
aleclarson:fix/glob-import
Closed

fix: use namespace import for glob package#959
aleclarson wants to merge 1 commit intomicrosoft:mainfrom
aleclarson:fix/glob-import

Conversation

@aleclarson
Copy link
Copy Markdown

@aleclarson aleclarson commented Apr 15, 2024

I was getting an error from the promisify(glob) call, as the glob import was being resolved to undefined at runtime. Switching to a namespace import like import * as glob and changing the reference to glob.default has fixed the issue for me.

Tested on Node v19, v20, and v21

I was getting an error from the `promisify(glob)` call, as the `glob` import was being resolved to undefined at runtime. Switching to a namespace import like `import * as glob` and changing the reference to `glob.default` has fixed the issue for me.
Copy link
Copy Markdown

@Crystal-RainSlide Crystal-RainSlide left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but glob's version is not supported:

> npm i @vscode/vsce
npm warn deprecated inflight@1.0.6: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated glob@7.2.3: Glob versions prior to v9 are no longer supported

> npm -g ls inflight
`-- @vscode/vsce@2.29.0
  `-- glob@7.2.3
    `-- inflight@1.0.6

An update would be great. Or it can be another PR.

If update to v10, which is async by default, that would be:

import { glob } from 'glob';
// ...
glob('**', { cwd: dep, nodir: true, dot: true, ignore: 'node_modules/**' }).then(files =>

@benibenj benibenj self-assigned this Jun 22, 2024
@benibenj
Copy link
Copy Markdown
Contributor

Fixed by updating dependency #1027

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants