Skip to content

anywhichway/modulastic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

modulastic

Express middleware to expose select Node modules to browser.

Configuration Object

{
  appDir: string, // root directory below which node_modules can be found, usually __dirname
  <browserRoot>: {
    <nameToExpose>: {
      packageName: string, // actual node package name, optional, defaults to <nameToExpose>, useful for @ prefixed packages
      pathName: string // subdirectory under the module to expose, usually "dist"
    }
  },
  ... more <browserRoot> objects, rarely used
}

Example

import {modulastic} from "modulastic";

const app = express(); // obviously need to import express first

app.use(modulastic(app,{
  modules: {
    quill: {pathName:"dist"},
    jsoneditor: {pathName:"dist"},
    "dialog-polyfill": {pathName:"dist"},
    "fontawesome": {packageName:"@fortawesome",pathName:"fontawesome-pro"}
  }, 
  appDir:__dirname
}));

License: MIT

Change History

2020-01-24 v0.0.3 Added git link 2020-01-24 v0.0.2 Updated README format

About

Express middleware to expose select Node modules to browser

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published