mirror of
https://github.com/mediacms-io/mediacms.git
synced 2024-12-04 06:03:33 +01:00
25 lines
746 B
JavaScript
25 lines
746 B
JavaScript
|
import typescript from 'rollup-plugin-typescript2';
|
||
|
import resolve from '@rollup/plugin-node-resolve';
|
||
|
import visualizer from 'rollup-plugin-visualizer';
|
||
|
import cleanup from 'rollup-plugin-cleanup';
|
||
|
|
||
|
export function buildCommonjs(input_file, output_folder) {
|
||
|
return function (filename, visualize) {
|
||
|
const plugins = [
|
||
|
resolve({ customResolveOptions: { moduleDirectories: 'node_modules' } }),
|
||
|
typescript(),
|
||
|
cleanup({ comments: 'none' }),
|
||
|
];
|
||
|
|
||
|
if (visualize) {
|
||
|
plugins.push(visualizer({ title: filename, filename: output_folder + filename + '.html' }));
|
||
|
}
|
||
|
|
||
|
return {
|
||
|
input: input_file,
|
||
|
output: [{ format: 'cjs', file: filename }],
|
||
|
plugins: plugins,
|
||
|
};
|
||
|
};
|
||
|
}
|