2020-07-12 15:58:07 +02:00
|
|
|
import babel from "rollup-plugin-babel";
|
|
|
|
import resolve from "rollup-plugin-node-resolve";
|
|
|
|
import commonjs from "rollup-plugin-commonjs";
|
|
|
|
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,
|
|
|
|
main,
|
|
|
|
module
|
|
|
|
} from "./package.json";
|
2020-04-18 11:35:28 +02:00
|
|
|
|
|
|
|
const output = [
|
|
|
|
{
|
|
|
|
file: main,
|
2020-07-12 15:58:07 +02:00
|
|
|
format: "cjs",
|
2020-04-18 11:35:28 +02:00
|
|
|
sourcemap: true
|
|
|
|
}
|
2020-07-12 15:58:07 +02:00
|
|
|
];
|
|
|
|
if (typeof module !== "undefined")
|
2020-04-18 11:35:28 +02:00
|
|
|
output.push({
|
|
|
|
file: module,
|
2020-07-12 15:58:07 +02:00
|
|
|
format: "es",
|
2020-04-18 11:35:28 +02:00
|
|
|
sourcemap: true
|
2020-07-12 15:58:07 +02:00
|
|
|
});
|
2020-04-18 11:35:28 +02:00
|
|
|
|
|
|
|
export default {
|
2020-07-12 15:58:07 +02:00
|
|
|
input: "src/index.js",
|
2020-04-18 11:35:28 +02:00
|
|
|
output,
|
|
|
|
plugins: [
|
|
|
|
peerDepsExternal(),
|
|
|
|
resolve({ modulesOnly: true }),
|
|
|
|
commonjs(),
|
|
|
|
json(),
|
|
|
|
babel({
|
2020-07-12 15:58:07 +02:00
|
|
|
exclude: "node_modules/**",
|
|
|
|
plugins: ["@babel/plugin-proposal-object-rest-spread"]
|
2020-04-18 11:35:28 +02:00
|
|
|
}),
|
|
|
|
minify({
|
|
|
|
comments: false,
|
|
|
|
sourceMap: true,
|
|
|
|
banner: `/**\n * ${name} | v${version}\n * ${description}\n * (c) ${new Date().getFullYear()} ${author}\n * @license ${license}\n */`
|
|
|
|
})
|
|
|
|
]
|
2020-07-12 15:58:07 +02:00
|
|
|
};
|