An open API service indexing awesome lists of open source software.

https://github.com/rookiemonkey/boilerplate-npm_on_browser

:wrench: :hammer: An example on how to use node modules on browser instead of a nodejs environment. WARNING :bangbang: not all node modules will work on browsers
https://github.com/rookiemonkey/boilerplate-npm_on_browser

boilerplate browserify template

Last synced: over 1 year ago
JSON representation

:wrench: :hammer: An example on how to use node modules on browser instead of a nodejs environment. WARNING :bangbang: not all node modules will work on browsers

Awesome Lists containing this project

README

          

1. require the npm package the you need
```
const Buffer = require('buffer').Buffer
```

2. Append the variable to the window object
```
global.window.Buffer = Buffer
```

3. Install browserify as devDep
```
yarn add browserify -D
```

4. Compile your main.js file using browserify
```
browserify main.js -o output.js
```

5. use your output.js on your html
```

```

6. run it on live server and check the window object on console if your npm
package is present (in this example, it is Buffer)
![](./screenshot/screen.jpg)