AR-js-org / AR.js

Image tracking, Location Based AR, Marker tracking. All on the Web.
MIT License
5.3k stars 909 forks source link

import AR.js classes in a <script type="module"> #535

Open kalwalt opened 1 year ago

kalwalt commented 1 year ago

Do you want to request a feature or report a bug? New feature to import AR.js classes in a <script type="module">.

What is the current behavior? If you try to import AR.js classes in module tag an error will appear in the developer console, with no interaction. Example code:

<script type="module">
import { ArToolkitContext, ArToolkitSource } from "./three.js/build/ar-threex.js"
/// your code
</script>

If the current behavior is a bug, please provide the steps to reproduce.

Please mention other relevant information such as the browser version, Operating System and Device Name

What is the expected behavior?

If this is a feature request, what is motivation or use case for changing the behavior? Starting from Three r151 It will possible to load three.js library only as a module, so if we want to use this version we need this kind of feature. It is possible to use an experimental webpack entry and with no efforts we wiill have this nice feature.