"use strict";

const baseConfig = require("./rollup.config");
const plugin = require("./plugin");
const path = require("path");

module.exports = baseConfig.map((config, index) => {
  config.plugins.push(plugin({
    open: true,
    filename: `stats.${index}.html`,
    template: getTemplateType(config)
  }));
  return config;
});

function getTemplateType({ input }) {
  const filename = path.basename(input, path.extname(input));
  const [, templateType] = filename.split("-");
  return templateType;
}

@@ -158,28 +158,67 @@
 map(
-(
 config
-, index) =%3E %7B
+ =%3E %7B%0A  const templateType = getTemplateType(config);
 %0A  c
@@ -236,16 +236,21 @@
 ns.push(
+%0A    
 plugin(%7B
@@ -254,16 +254,18 @@
 n(%7B%0A    
+ 
+ 
 open: tr
@@ -268,16 +268,18 @@
 : true,%0A
+  
     file
@@ -297,13 +297,20 @@
 s.$%7B
-index
+templateType
 %7D.ht
@@ -318,16 +318,18 @@
 l%60,%0A    
+  
 template
@@ -330,20 +330,17 @@
 mplate: 
-getT
+t
 emplateT
@@ -346,21 +346,18 @@
 Type
-(config)%0A
+%0A  
   %7D)
+%0A  
 );%0A 

Use template name for statts file name