简体   繁体   English

可以用browserify合并我的js文件,而无需包含自己的代码

[英]Can browserify combine my js files without including own code

Can browserifyJS compile my javascript project (browser code) in a single static file without adding own code at the top of the compiled file? browserifyJS可以在单个静态文件中编译我的javascript项目(浏览器代码),而无需在编译文件的顶部添加自己的代码吗? The structure of my project is very simple (5-7 submodules) so I don't want to see any dependency management in runtime. 我的项目的结构非常简单(5-7个子模块),所以我不想在运行时看到任何依赖项管理。

Is there any other tool to do this? 还有其他工具可以做到这一点吗? (r.js or something else?) (r.js还是其他?)

It is possible for you to do this just by using Browserify alone, or you can use grunt-browserify . 您可以仅通过单独使用Browserify来执行此操作,也可以使用grunt-browserify The impact will be you have to get use to writing node.js/CommonJS style require() . 影响将是您必须习惯于编写node.js / CommonJS风格的require()

An example is avaiable here . 这里有一个例子。

可能的解决方案是将Grunt requirejs插件AMDclean一起使用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM