interval-tree2
interval-tree2 copied to clipboard
compiling for web use
Could you add details about how to compile your code for use in the web?
On your homepage, you show:
<script src="dist/interval-tree.js"></script>
but there is no dist/folder in your repository.
Alright, so per the readme (should have started there), I
$ npm install interval-tree2
and found the dist directory.
And, then to make it in a library I can drop into a browser, I ran
browserify interval-tree.js -o my-interval-tree.js
And then I successfully add
<script src="dist/my-interval-tree.js"></script>
But then when I try to instantiate an IntervalTree,
Uncaught ReferenceError: IntervalTree is not defined
OK, I should prepare browser field in package.json.
Now, why don't you run with standalone option?
browserify --standalone IntervalTree dist/interval-tree.js > /path/to/web/dir/interval-tree.js
I did not use standalone because I did not know about it. Thank you!
This seems like a great lib but it's not easy at all to use in the browser. it is coupled with using the require way of browserify (which I don't use or will ever)..I would wish there was a way to just get a single javascript file and use it..