https://github.com/vivaxy/nib
🔬Run commonjs modules in browser environment.
https://github.com/vivaxy/nib
browser commonjs debug exports modules node node-in-browser nodejs require
Last synced: 5 months ago
JSON representation
🔬Run commonjs modules in browser environment.
- Host: GitHub
- URL: https://github.com/vivaxy/nib
- Owner: vivaxy
- License: mit
- Created: 2018-08-16T07:15:57.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2024-05-24T05:32:14.000Z (over 1 year ago)
- Last Synced: 2025-08-08T23:55:20.817Z (5 months ago)
- Topics: browser, commonjs, debug, exports, modules, node, node-in-browser, nodejs, require
- Language: JavaScript
- Homepage: https://github.com/vivaxy/NiB
- Size: 507 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Citation: CITATION.cff
Awesome Lists containing this project
README
# NiB
Run Node.js modules in browser environment.
[![NPM Version][npm-version-image]][npm-url]
[![NPM Downloads][npm-downloads-image]][npm-url]
[![MIT License][license-image]][license-url]
[![Standard Version][standard-version-image]][standard-version-url]
# Install
`yarn add @vivaxy/nib` or `npm i @vivaxy/nib`
# Usage
```html
window.node.init({ base: '.', nodeBuiltInBase: 'https://unpkg.com/@vivaxy/nib', nodeModulesBase: 'https://unpkg.com' });
window.node.require('./index.js');
```
## Options
- `base`: path from html to your commonjs module
- `nodeBuiltInBase`: path from html to `@vivaxy/nib`
- `nodeModulesBase`: path from html to `node_modules`
In your `./index.js` you can now use `require` and `module.exports`!
See [test](https://vivaxy.github.io/NiB/__tests__/index.html) and [test source](./__tests__).
[npm-version-image]: https://img.shields.io/npm/v/@vivaxy/nib.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@vivaxy/nib
[npm-downloads-image]: https://img.shields.io/npm/dt/@vivaxy/nib.svg?style=flat-square
[license-image]: https://img.shields.io/npm/l/@vivaxy/nib.svg?style=flat-square
[license-url]: LICENSE
[standard-version-image]: https://img.shields.io/badge/release-standard%20version-brightgreen.svg?style=flat-square
[standard-version-url]: https://github.com/conventional-changelog/standard-version