🔧 Changed export for components
This commit is contained in:
parent
3c31cc779f
commit
4d24dfe998
8 changed files with 66 additions and 51 deletions
|
@ -4,24 +4,38 @@ import json from "rollup-plugin-json";
|
|||
import minify from "rollup-plugin-babel-minify";
|
||||
import peerDepsExternal from "rollup-plugin-peer-deps-external";
|
||||
import { name, version, description, author, license } from "./package.json";
|
||||
import components from "./src/index.js";
|
||||
|
||||
export default {
|
||||
input: "src/index.js",
|
||||
output: {
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
peerDepsExternal(),
|
||||
resolve({ modulesOnly: true }),
|
||||
json(),
|
||||
babel({
|
||||
exclude: "node_modules/**",
|
||||
plugins: ["@babel/plugin-proposal-object-rest-spread"]
|
||||
}),
|
||||
minify({
|
||||
comments: false,
|
||||
sourceMap: true,
|
||||
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||
})
|
||||
]
|
||||
const createConfig = (component, module) => {
|
||||
console.log(component);
|
||||
return {
|
||||
input: `./src/${component}/index.js`,
|
||||
output: {
|
||||
file: `dist/${component}/index` + (module ? ".mjs" : ".js"),
|
||||
format: module ? "es" : "cjs",
|
||||
sourcemap: true
|
||||
},
|
||||
plugins: [
|
||||
peerDepsExternal(),
|
||||
resolve({ modulesOnly: true }),
|
||||
json(),
|
||||
babel({
|
||||
exclude: "node_modules/**",
|
||||
plugins: ["@babel/plugin-proposal-object-rest-spread"]
|
||||
}),
|
||||
minify({
|
||||
comments: false,
|
||||
sourceMap: true,
|
||||
banner: `/**\n * ${name}/${component} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
||||
})
|
||||
]
|
||||
};
|
||||
};
|
||||
|
||||
const config = [];
|
||||
for (let component of components) {
|
||||
config.push(createConfig(component, false));
|
||||
config.push(createConfig(component, true));
|
||||
}
|
||||
console.log(JSON.stringify(config, null, 2));
|
||||
export default config;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue