-
-
Notifications
You must be signed in to change notification settings - Fork 688
Open
Milestone
Description
JavaScript's native import syntax is gaining support and usage – the latest version of three.js no longer supports require() for some modules and so presently cannot be used with haxe haxiomic/dts2hx#110
Haxe currently has @:jsRequire which when added to externs, generates require() calls for module imports
I think we could add @:jsImport (or @:js.import) which would generate import statements instead. For example:
@:jsRequire("three/examples/jsm/controls/OrbitControls", "OrbitControls") extern class OrbitControls {
// generates
var three_examples_jsm_controls_orbitcontrols_OrbitControls = require("three/examples/jsm/controls/OrbitControls.js").OrbitControls;This would become
@:js.import("three/examples/jsm/controls/OrbitControls.js", "OrbitControls") extern class OrbitControls {
// generates *at top of file*
import { OrbitControls as three_examples_jsm_controls_orbitcontrols_OrbitControls } from "three/examples/jsm/controls/OrbitControls.js";Or as Simn suggests, this may be better as
@:js.import("OrbitControls", "three/examples/jsm/controls/OrbitControls.js") To mirror the js import syntax
cedx, fullofcaffeine, sinh-png, acarioni, joshtynjala and 1 more
Metadata
Metadata
Assignees
Labels
No labels