Skip to content

[Feature request] Synchronous support #81

Description

@lokimckay

Is it possible to execute tiny-glob synchronously?

My specific use case is in a rollup.config.js file, I need to execute tiny-glob to retrieve a list of file paths, and then use those paths to export a config object. E.g.:

import glob from "tiny-glob";

const components = await glob("src/components/**/*.component.js").then((paths) =>
  paths.map((path) => path.match(/.*[\\\/](.*?).component.js/)[1])
);

export default components.map((component) => ({
  ...
}));

But rollup does not play nice with the await keyword being used

Is there a way to run tiny-glob synchronously? and if not, would this feature be considered for inclusion?

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions