I am trying browserify and I have the following files in my project directory
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With