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.
The following does not work when trying to run any Gulp tasks:
When using the
requiresyntax the code works fine: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
gulpdirectory.