Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to use browserify in windows

I am trying browserify and I have the following files in my project directory

  • node_models/.bin - where browserify is located
  • sample.js

    module.exports = 'Hello, world';
    
  • index.js

    window.alert(require('./sample'));
    

Can somebody help me how to run it using browserify? I'm using Windows.

like image 611
Ermene Avatar asked Oct 17 '22 19:10

Ermene


1 Answers

All you should need to do is run this command in the project directory:

node_modules\.bin\browserify index.js > bundle.js

However, you can make things a little more convinient by adding an entry under scripts in your package.json:

{
    ...
    "scripts": {
        "bundle": "browserify index.js > bundle.js"
    }
}

You can then build the bundle with this command:

npm run bundle
like image 67
cartant Avatar answered Nov 01 '22 14:11

cartant