haxiomic / dts2hx

Converts TypeScript definition files (d.ts) to haxe externs (.hx) via the TypeScript compiler API
MIT License
131 stars 8 forks source link

[ERROR] Could not resolve "three/src/math/MathUtils" #112

Open sonygod opened 2 years ago

sonygod commented 2 years ago

three.js 138


import three.src.math.MathUtils;

    var x=180*MathUtils.DEG2RAD;
        trace(x);

after compile will get this error.


X [ERROR] Could not resolve "three/src/math/MathUtils"

    dist/main.js:64:39:
      64 │ var three_src_math_MathUtils = require("three/src/math/MathUtils");
         ╵                                        ~~~~~~~~~~~~~~~~~~~~~~~~~~  

  The module "./src/math/MathUtils" was not found on the file system:
``
---------------------------

sources[ here](https://github.com/haxiomic/dts2hx/files/8264875/three138.zip)
haxiomic commented 2 years ago

Hmm, looks like MathUtils has two exports, both Three.MathUtils and three/src/math/MathUtils and dts2hx need to choose just 1

For now a quick fix would be to replace the @:jsRequire in MathUtils.hx with @:jsRequire("three", "MathUtils")

Not ideal I know but I'll keep this issue in mind next time I work on dts2hx

sonygod commented 2 years ago

@haxiomic , your suggestions were wrong.

can you debug

var x=180*MathUtils.DEG2RAD;
    trace(x);

x vaule is NaN.

haxiomic commented 2 years ago

My bad, I copied the wrong line, should be @:jsRequire("three", "MathUtils")

sonygod commented 2 years ago

same error BufferGeometryUtils

https://github.com/haxiomic/dts2hx/issues/114

thank you .it's work.

when will you release the next version dts2hx? haha

haxiomic commented 2 years ago

Next version could take a while, my project schedule doesn't allow the time investment at the moment. Open to PRs if anyone want to make improvements in the near term!