如何使用Browserify包含我自己的(非模块化)脚本?

时间:2016-01-23 10:48:35

标签: javascript node.js gulp browserify

我使用browserify来使用模块。

我有一个不是 CommonJS模块的JS文件(不使用exports / module)。

  

File3.js

var scr = require('./utils/scripts.js');
scr.go(555); // note there is no `module.exports` here

scripts.js

function go(a)
{
 console.log("go:"+a);
}

所以现在我要添加' file3.js'到我的gulp文件:

 // main.js and main2.js are CommonJS modules and without file3 it works
 entries: ['./client/app/file3.js','./client/app/main.js', './client/app/main2.js'],

(建筑:.....成功)

但是现在当我运行页面时,我收到一个错误:

enter image description here

我如何包含"常规"使用Browserify的JS文件? (不寻找直接将其添加到index.html中的解决方案)

0 个答案:

没有答案