ales
DIAdiscord.js - Imagine an app
•Created by ales on 2/25/2024 in #djs-questions
Converting the Command Handler and the Command Deployer to use ES modules
I am attempting to convert my project to an ES Module instead of using CommonJS. I've already changed imports from
require()
to import
, and i've changed the package.json to include "type": "module"
. The problem is changing the command handler and command deployer to work, since both (taken directly from the guide) were designed to work using CommonJS.
djs version: 14.14.1
node version: 18.10.0
The first issue is that __dirname is not defined. There are also issues with joining paths. Any suggestions on how to best modify the command handler to work with ES Modules would be greatly appreciated.
Code will be included in my next message because of character limits11 replies