ZeldaFan0225 / ai_horde

A package to interact with the stable horde API
MIT License
35 stars 16 forks source link

import statement does not work as expected #13

Closed tomasreichmann closed 7 months ago

tomasreichmann commented 7 months ago

I am trying to add this package to a vitejs project which does not support commonjs modules, so I have to use import instead of require.

I would expect this to work import AIHorde, { AIHordeInitOptions } from "@zeldafan0225/ai_horde";

But it seems all imports are part of the default import instead:

console.log("AIHorde", AIHorde);
console.log("AIHorde.AIHorde", AIHorde.AIHorde);
console.log("AIHorde.AIHorde.AIHorde", AIHorde.AIHorde.AIHorde);
image

This causes and error that the named export AIHorde is missing import { AIHorde } from "@zeldafan0225/ai_horde";

ZeldaFan0225 commented 7 months ago

I will look into it, I don't have a lot of experience with es module only projects. If it helps maybe take a look at the Discord bot that uses this package. https://github.com/ZeldaFan0225/AI_Horde_Discord/blob/main/src/classes/client.ts#L9

tomasreichmann commented 7 months ago

Wow, that was quick. GG 👍