mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 04:23:31 +01:00
fix: structure imports on windows (#10835)
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import type { PathLike } from 'node:fs';
|
import type { PathLike } from 'node:fs';
|
||||||
import { readdir, stat } from 'node:fs/promises';
|
import { readdir, stat } from 'node:fs/promises';
|
||||||
import { fileURLToPath, URL } from 'node:url';
|
import { URL } from 'node:url';
|
||||||
import type { Command } from '../commands/index.ts';
|
import type { Command } from '../commands/index.ts';
|
||||||
import { predicate as commandPredicate } from '../commands/index.ts';
|
import { predicate as commandPredicate } from '../commands/index.ts';
|
||||||
import type { Event } from '../events/index.ts';
|
import type { Event } from '../events/index.ts';
|
||||||
@@ -57,7 +57,7 @@ export async function loadStructures<T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Import the structure dynamically from the file
|
// Import the structure dynamically from the file
|
||||||
const structure = (await import(fileURLToPath(fileUrl))).default;
|
const structure = (await import(fileUrl.toString())).default;
|
||||||
|
|
||||||
// If the structure is a valid structure, add it
|
// If the structure is a valid structure, add it
|
||||||
if (predicate(structure)) {
|
if (predicate(structure)) {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { readdir, stat } from 'node:fs/promises';
|
import { readdir, stat } from 'node:fs/promises';
|
||||||
import { fileURLToPath, URL } from 'node:url';
|
import { URL } from 'node:url';
|
||||||
import { predicate as commandPredicate } from '../commands/index.js';
|
import { predicate as commandPredicate } from '../commands/index.js';
|
||||||
import { predicate as eventPredicate } from '../events/index.js';
|
import { predicate as eventPredicate } from '../events/index.js';
|
||||||
|
|
||||||
@@ -54,7 +54,7 @@ export async function loadStructures(dir, predicate, recursive = true) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Import the structure dynamically from the file
|
// Import the structure dynamically from the file
|
||||||
const structure = (await import(fileURLToPath(fileUrl))).default;
|
const structure = (await import(fileUrl.toString())).default;
|
||||||
|
|
||||||
// If the structure is a valid structure, add it
|
// If the structure is a valid structure, add it
|
||||||
if (predicate(structure)) {
|
if (predicate(structure)) {
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import type { PathLike } from 'node:fs';
|
import type { PathLike } from 'node:fs';
|
||||||
import { readdir, stat } from 'node:fs/promises';
|
import { readdir, stat } from 'node:fs/promises';
|
||||||
import { fileURLToPath, URL } from 'node:url';
|
import { URL } from 'node:url';
|
||||||
import type { Command } from '../commands/index.[REPLACE_IMPORT_EXT]';
|
import type { Command } from '../commands/index.[REPLACE_IMPORT_EXT]';
|
||||||
import { predicate as commandPredicate } from '../commands/index.[REPLACE_IMPORT_EXT]';
|
import { predicate as commandPredicate } from '../commands/index.[REPLACE_IMPORT_EXT]';
|
||||||
import type { Event } from '../events/index.[REPLACE_IMPORT_EXT]';
|
import type { Event } from '../events/index.[REPLACE_IMPORT_EXT]';
|
||||||
@@ -57,7 +57,7 @@ export async function loadStructures<T>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Import the structure dynamically from the file
|
// Import the structure dynamically from the file
|
||||||
const structure = (await import(fileURLToPath(fileUrl))).default;
|
const structure = (await import(fileUrl.toString())).default;
|
||||||
|
|
||||||
// If the structure is a valid structure, add it
|
// If the structure is a valid structure, add it
|
||||||
if (predicate(structure)) structures.push(structure);
|
if (predicate(structure)) structures.push(structure);
|
||||||
|
|||||||
Reference in New Issue
Block a user