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

Dynamic import support for Gulp #10

Open
ajmeese7 opened this issue Dec 1, 2022 · 0 comments
Open

Dynamic import support for Gulp #10

ajmeese7 opened this issue Dec 1, 2022 · 0 comments

Comments

@ajmeese7
Copy link

ajmeese7 commented Dec 1, 2022

The following does not work when trying to run any Gulp tasks:

import read from "fs-readdir-recursive";

/**
 * This will load all js in the gulp directory
 */
read("./gulp")
  .filter(function (file) {
    console.log(file);
    return /\.(js)$/i.test(file);
  })
  .map(async function (file) {
    await import("./gulp/" + file);
  });

When using the require syntax the code works fine:

const read = require("fs-readdir-recursive");

/**
 *  This will load all js in the gulp directory
 */
read("./gulp")
  .filter(function (file) {
    console.log(file);
    return /\.(js)$/i.test(file);
  })
  .map(function (file) {
    require("./gulp/" + file);
  });

The ESM syntax is the problem. Would love to see support added for this! In the meantime I'll have to manually import each file from the gulp directory.

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

No branches or pull requests

1 participant