What is Lectro
Lectro enables Node Application to work with different languages that compiles to JS, very smoothly whether it is Coffeescript, Purescript, Typescript or even OCaml (BuckleScript)
Lectro uses Webpack and its loaders internally, but it is extremely easier to use and extend.
Lectro Core API provides
A devserver to run Node Application which restarts whenever any file changes, powered by nodemon.
A Build Command to build your Node Application to one bundle.
An Extend Command to extend Lectro capabilities, mostly to include a file loader.
- To use the devserver
const Lectro = require('@lectro/core'); (new Lectro('web'/* or node*/)).dev();
Now save this file as run.js at your project root and start the server with node run.js
Devserver assumes your entry file at src/index.js
- To build your application
const Lectro = require('@lectro/core'); (new Lectro('web'/* or node*/)).build();
Now save this file as build.js at your project root and start the build with node build.js
Enter the Enhancers
An Enhancer typically enhances lectro features
const Lectro = require('@lectro/core') const CommonUtilsEnhancer = require('@lectro/enhancer-commonutils') const lectro = new Lectro('web'/* Target */).apply(CommonUtilsEnhancer)