How can I import a.js
and b.js
and export as combined bundle.js
in UMD format using rollupjs?
Here is the example:
//a.js
export default class A {
...
}
//b.js
export default class B {
...
}
My current rollup.config.js
is:
export default [
{
input: ["path/a.js", "path/b.js"],
output: {
file: "path/bundle.js",
format: "umd",
name: "Bundle"
},
plugins: [
// list of plugins
]
}
}
However, this is not working as intended.
Anything wrong with this config?
Thanks for your help.
答案 0 :(得分:0)
您需要一个文件来将它们绑在一起。因此,与a.js
和b.js
一起,有一个main.js
如下所示:
import A from './a';
import B from './b';
export default {
A,
B,
};
然后用rollup.config.js
更新您的input: path/main.js
。