Tuesday, January 31, 2017

notes from exporting a library with browserify so that it can be used with require.js

Exporting a library with browserify, so that it can be used by require.js

http://dontkry.com/posts/code/browserify-and-the-universal-module-definition.html

based on:

http://ifandelse.com/its-not-hard-making-your-library-support-amd-and-commonjs/ 

edit: also see:

https://www.leanpanda.com/blog/2015/06/28/amd-requirejs-commonjs-browserify/

or try:

http://webpack.github.io/docs/usage.html

edit: target:
https://github.com/RubenVerborgh/N3.js

edit: notes from interactions with Dr. Verborgh :

 "The generated n3-browser.js is standalone and not for usage with require.

To obtain a library for usage with require, you have to use a utility such as browserify (http://browserify.org/).
N3.js is designed for compatibility with browserify. Then you can continue your exact use case.
(See https://github.com/RubenVerborgh/N3.js#installation.)"

"This gives in the browser:
> Util,Lexer,Parser,Writer,Store....

Indeed, that's how n3-browser.js works:
it exposes a global N3 object."

1 comment: