Gulp 使用多个条目浏览导出
TL;DR:如何在browserify中对每个条目文件进行多次导出 我需要使用browserify为AngularJS构建独立的库 Configs看起来是这样的:Gulp 使用多个条目浏览导出,gulp,browserify,Gulp,Browserify,TL;DR:如何在browserify中对每个条目文件进行多次导出 我需要使用browserify为AngularJS构建独立的库 Configs看起来是这样的: module.exports = { module: { name: 'bbShell', styles: 'styles', standalone: 'bb.shell', export: 'bb.shell' }, file: {
module.exports = {
module: {
name: 'bbShell',
styles: 'styles',
standalone: 'bb.shell',
export: 'bb.shell'
},
file: {
lib: [
'bower_components/signalr/*.js',
'node_modules/powerbi-client/dist/**/*'
]
},
browserify: {
entries: [
'./temp/shell-html.min.js',
'./src/index.ts',
]
},
};
所以我定义了多个入口点,并在构建脚本中处理它。一个文件也可以,但当我有多个入口点时,browserify导出似乎只有一个入口点:
(function(f) {
if (typeof exports === "object" && typeof module !== "undefined") {
module.exports = f();
} else if (typeof define === "function" && define.amd) {
define([], f);
} else {
var g;
if (typeof window !== "undefined") {
g = window;
} else if (typeof global !== "undefined") {
g = global;
} else if (typeof self !== "undefined") {
g = self;
} else {
g = this;
}
(g.bb || (g.bb = {})).shell = f();
}
})(function() {
var define, module, exports;
return function() {
...
}()({1: ..., 2: ...
}, {}, [ 174, 88 ])(174);
// 174 represents 'shell-html.min.js' and 88 is 'index.ts'
// should be (174,88), but (174) generated
});
顺序并不重要,它可以通过单个js文件导出来生成捆绑包,但如果捆绑包中不包含“shell html.min.js”,则一切都可以