最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Browserify multiple files into a single bundle - Stack Overflow

programmeradmin1浏览0评论

Currently, I browserify a single js file into a bundle.js

$ browserify X1.js --standalone XXX > bundle.js

What if I have multiple js files and want to join them into a single browserified bundle.js

How should the command look like? Can I do something like this?

$ browserify X1.js X2.js --standalone XXX > bundle.js

I am using node.js v6

Currently, I browserify a single js file into a bundle.js

$ browserify X1.js --standalone XXX > bundle.js

What if I have multiple js files and want to join them into a single browserified bundle.js

How should the command look like? Can I do something like this?

$ browserify X1.js X2.js --standalone XXX > bundle.js

I am using node.js v6

Share Improve this question asked Nov 8, 2016 at 10:18 guagay_wkguagay_wk 28.1k63 gold badges198 silver badges309 bronze badges 3
  • Which task runner you are using ? – Krishna9960 Commented Nov 8, 2016 at 10:21
  • I am not using any task runner. I am just running the command on a normal Windows command prompt. – guagay_wk Commented Nov 8, 2016 at 10:21
  • 4 Based on the syntax of their documentation: browserify [entry files] {OPTIONS}, yes, you can add as many files as you want like you are doing in your second command. – Eduardo Páez Rubio Commented Nov 8, 2016 at 10:31
Add a comment  | 

3 Answers 3

Reset to default 13

You have already answered your own question. I confirm that it is correct.

$ browserify X1.js X2.js --standalone XXX > bundle.js

If your command line supports expansion, you can use * to include all files in a directory:

$ browserify *.js --standalone XXX > distribution/bundle.js

Use the browserify command to build a bundle

 $ browserify X1.js X2.js > bundle.js
发布评论

评论列表(0)

  1. 暂无评论