-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support native JS import syntax #110
Comments
Good question! Looks like they've dropped support for When that arrives, I will also need to update dts2hx to support this So it could take a few months for this to work. In the meantime best thing to do is use an older version of three |
Is there any way to support these features right now by hand hard code or string replace ? |
There is! Details here HaxeFoundation/haxe#10615 (comment) |
well,I will try ,thank you. @haxiomic |
now ,the code can compile,but runtime still get error.
build.hxml --main Main
--class-path src
--library three
--library jsImport
--js bin/app.js
# optimization settings
--dce full
-D analyzer-optimize
# generate ES6 output
-D js-es=6
--debug
# this bundles three.js into the output (only required because we are using three.js)
--cmd npx esbuild bin/app.js --bundle --outfile=bin/bundle.js --sourcemap
|
Make sure your using my fork of jsImport: https://github.com/haxiomic/jsImport I added a feature that solves this |
@haxiomic I'm sure use your version of jsImport haxelib git jsImport https://github.com/haxiomic/jsImport You already have jsImport version git installed. Updating jsImport version git ... jsImport was updated Library jsImport current version is now git and gen app.js still
instead of let controls = new OrbitControls(camera,canvas); Generated by Haxe 4.3.0-rc.1+2810be1 |
hmm, here's a test project that works for me, do Also try a direct Going to bed, will check back tomorrow o/ |
hello,@haxiomic ,what version of your haxe? the r138-test.zip still not work. |
haxe 4.2.4, what does your app.js look like? |
@sonygod Ahh I understand what is going on, this is my bad. I made my changes to jsimport too quickly. I think I've fixed it now Try updating jsimport |
after update?
|
That looks like you're probably using the original version, not my mod, however my PR has now merged so if you If it's not, double check you have this line in jsImport Macro.hx |
after haxelib update jsImport work. batch: use this reg replace.
|
I'm going to reopen this as a feature request for js import syntax |
@haxiomic I add a macro about namespace.. look this code
the new version of three.js is import {XXX} from 'three' so I add some code in Macro.hx case [{ params: [macro @ns $v{(v:String)}] }]:
lines.push('import { $className as $id } from "$v";'); and test code. @:js.import(@ns "three") extern class PerspectiveCamera extends Camera {
//will compile
import { PerspectiveCamera as three_PerspectiveCamera } from "three"; |
Question about three.js es6 version
hello ,after update three.js r138 , it seem all class write in es6 style.
and try to use esbuild and got these error. Don't know How to fix that error.
The text was updated successfully, but these errors were encountered: