ige icon indicating copy to clipboard operation
ige copied to clipboard

IGE-ES6 - Using the engine as a module\project reference is broken by recent change

Open beyond-code-github opened this issue 1 year ago • 4 comments

This change below has resulted in a subtle difference in the generated .js file for the index of the module. This wouldn't be apparent unless you are referencing IGE as a module or via a typescript project reference (I am doing the latter).

https://github.com/Irrelon/ige/blob/6d0b289a154832dde9b7c0fcf989caa9ea24cbd6/index.ts#L3

It seems to be that the compiler is having difficulty following the custom paths starting with '@' when processing an export directive. I tried to work around it by replacing import { ige } from "@irrelon/ige"; with import { ige } from "@/engine/instance.js"; but there's a further snafu which means that if there are no imports of the index.ts file then you don't pull in the ige-specific extensions to the Event type defined there, which breaks compilation as well.

@Irrelon Could this change be rolled back?

beyond-code-github avatar Apr 26 '23 04:04 beyond-code-github

Use npm run fixPaths :)

markhughes avatar Apr 28 '23 08:04 markhughes

Thanks for the suggestion! Unfortunately it had no effect on the contents of index.js

beyond-code-github avatar Apr 28 '23 08:04 beyond-code-github

This change below has resulted in a subtle difference in the generated .js file for the index of the module. This wouldn't be apparent unless you are referencing IGE as a module or via a typescript project reference (I am doing the latter).

https://github.com/Irrelon/ige/blob/6d0b289a154832dde9b7c0fcf989caa9ea24cbd6/index.ts#L3

It seems to be that the compiler is having difficulty following the custom paths starting with '@' when processing an export directive. I tried to work around it by replacing import { ige } from "@irrelon/ige"; with import { ige } from "@/engine/instance.js"; but there's a further snafu which means that if there are no imports of the index.ts file then you don't pull in the ige-specific extensions to the Event type defined there, which breaks compilation as well.

@Irrelon Could this change be rolled back?

Hey ya! Are you consuming the engine via its compiled js files or directly via the ts files?

The /index.js file should have the contents:

export * from "engine/instance";

So the custom TypeScript paths shouldn't interfere. If you are using the engine via TS directly, it's not a setup I've tried, could you throw together a barebones example project of how you're doing it so I can debug from my end? A github project I can clone would be great.

Irrelon avatar May 02 '23 14:05 Irrelon

Hi mate, sorry for the delay I've been on holiday for a couple of weeks back in England. Will try to put something together for you asap.

beyond-code-github avatar May 26 '23 04:05 beyond-code-github