2021-01-30 03:54:52 +01:00
|
|
|
import commonjs from "@rollup/plugin-commonjs"
|
2021-01-21 17:44:03 +01:00
|
|
|
import resolve from "rollup-plugin-node-resolve"
|
|
|
|
import json from "@rollup/plugin-json"
|
2021-01-30 01:20:13 +01:00
|
|
|
import { terser } from "rollup-plugin-terser"
|
2021-03-31 19:49:53 +02:00
|
|
|
import builtins from "rollup-plugin-node-builtins"
|
|
|
|
import globals from "rollup-plugin-node-globals"
|
2021-01-18 18:40:19 +01:00
|
|
|
|
2021-01-30 01:20:13 +01:00
|
|
|
const production = !process.env.ROLLUP_WATCH
|
2021-03-31 17:14:56 +02:00
|
|
|
|
|
|
|
const plugins = [
|
|
|
|
resolve({
|
|
|
|
browser: true,
|
|
|
|
preferBuiltins: true,
|
|
|
|
}),
|
|
|
|
commonjs(),
|
2021-03-31 19:49:53 +02:00
|
|
|
builtins(),
|
|
|
|
globals(),
|
2021-03-31 17:14:56 +02:00
|
|
|
production && terser(),
|
|
|
|
json(),
|
|
|
|
]
|
|
|
|
|
|
|
|
export default [
|
|
|
|
{
|
|
|
|
input: "src/index.mjs",
|
|
|
|
output: {
|
|
|
|
sourcemap: !production,
|
2021-01-30 03:54:52 +01:00
|
|
|
format: "esm",
|
2021-03-31 17:14:56 +02:00
|
|
|
file: "./dist/bundle.mjs",
|
|
|
|
},
|
|
|
|
plugins,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
input: "src/index.cjs",
|
|
|
|
output: {
|
|
|
|
sourcemap: !production,
|
|
|
|
format: "cjs",
|
|
|
|
file: "./dist/bundle.cjs",
|
2021-01-21 18:30:18 +01:00
|
|
|
exports: "named",
|
2021-01-19 16:29:49 +01:00
|
|
|
},
|
2021-03-31 17:14:56 +02:00
|
|
|
plugins,
|
|
|
|
},
|
|
|
|
]
|