user3814030
user3814030

Reputation: 1283

Which file I have to include in order to use browserify

I want to use a module that uses require. I have installed browserify with node for that reason. My problem is that I can't find which javascript file I have to include in my html page in order to use browseriry.

Upvotes: 0

Views: 51

Answers (1)

CodingWithSpike
CodingWithSpike

Reputation: 43718

Typically Browserify is run as a step in your build process, and outputs a .js file that contains all the required modules. You would then add that in your web page. This means you should be running Browserify from the command line (or Grunt or Gulp if you use one of those tools) to build the JavaScript file to be deployed.

The "Hello World" example on the Browserify home page walks through these steps. In their example they run the command

browserify main.js -o bundle.js

to process the main.js file, find all required modules, and bundle them together into bundle.js.

The web page would then only need to include bundle.js

<script src="bundle.js"></script>

Upvotes: 1

Related Questions