配置Rollupjs生成库时,如果输入是由多个javascript文件组成的数组。我们如何才能将这些输入生成为一个输出 js 文件呢?
export const lgService = {
input: [
'./src/app/services/livegiver/lgservices.js',
'./src/app/services/readable-stream.js'
],
output: {
file: outputPath + 'LiveGiver/index.js',
format: 'es'
}
}
预期的:
Input: [a.js, b.js]
Output: dist/index.js
Actual:
Input: [a.js, b.js]
Output: dist/a.js; dist/b.js
你不能——多个输入意味着多个输出。要执行您所描述的操作,您需要有一个如下所示的单个入口模块:
import './app/services/livegiver/lgservices.js';
import './app/services/readable-stream.js';
如果您需要动态生成该模块,您可以使用类似的东西汇总插件虚拟 https://github.com/rollup/rollup-plugin-virtual.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)