vanilla-require
The Node and npm have an incredible system for the inclusion of packages, made by require
.
However, to use packages one must export their modules, through module.exports
. Yet, it is not possible to use these packages on simple web pages because the web browser does not recognize the module.exports
.
This package allows you to develop simple classes to the web and export them to Node script as a module. In this sense, you can use your classes in the web browser and in the Node script, using the vanilla-require
package.
Vanilla JS: pure Javascript.
Installation
npm install --save vanilla-require
Example
See test/test.js
for another example.
A Vanilla class (Calculator.js
):
{ return num1+num2; }
Your Node code:
/* Include */const vr = __dirname;// Instance a Vanilla Classconst Calculator = vr; // Enjoy the Class!let myCalc = a = 2 b = 3; consoleconsole;
Also look ~
- License GPL v3
- Create by Leonardo Mauro ~ leomaurodesenv