mind-ar-js
mind-ar-js copied to clipboard
ES6 module support
Anyone has experience building library with es6 module? The goal is to allow module import for MindAR, which will be similar to importing three.js, e.g.
<script type="module">
import MindAR from './mindar-image.esm.js';
</script>
Apparently, I'm having a hard time doing that. I feel like it shouldn't be too difficult.
Currently, we are only using a simple webpack config: https://github.com/hiukim/mind-ar-js/blob/master/webpack.config.prod.cjs
Anyone can advice what are the necessary changes?
I've been importing it like this in my tests:
import 'mind-ar/dist/mindar-image.prod.js';
Don't know much about webpack though.
In the output field you should add an entry libraryTarget: 'umd', in this way webpack will build for the major standards (module too).
@ThorstenBux Yes, right now, I'm simply assigning it to the window object, e.g. window.MINDAR, but it isn't being exported as a module.
@kalwalt I believe I've tried that without much luck.
Do you still have this problem ? I can have a look!
@Makio64 Yes, please. Appreciate it! :)