Maybe 2
This commit is contained in:
parent
4745fb5145
commit
ba0ceda03a
@ -1,5 +1,6 @@
|
|||||||
import * as fs from 'fs'
|
import * as fs from 'fs'
|
||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
|
import { pathToFileURL } from 'url'
|
||||||
|
|
||||||
import Logger, { LoggerType } from '#application/logger'
|
import Logger, { LoggerType } from '#application/logger'
|
||||||
import { getAppPath } from '#application/storage'
|
import { getAppPath } from '#application/storage'
|
||||||
@ -34,7 +35,7 @@ export class CommandRegistry {
|
|||||||
const filePath = getAppPath('commands', file.name)
|
const filePath = getAppPath('commands', file.name)
|
||||||
const commandName = path.basename(file.name, path.extname(file.name))
|
const commandName = path.basename(file.name, path.extname(file.name))
|
||||||
|
|
||||||
const module = await import(filePath)
|
const module = await import(pathToFileURL(filePath).href)
|
||||||
if (typeof module.default !== 'function') {
|
if (typeof module.default !== 'function') {
|
||||||
this.logger.warn(`Unrecognized export in ${file.name}`)
|
this.logger.warn(`Unrecognized export in ${file.name}`)
|
||||||
return
|
return
|
||||||
|
Loading…
x
Reference in New Issue
Block a user