-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathrollup.config.ts
36 lines (32 loc) · 952 Bytes
/
rollup.config.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import { terser } from "rollup-plugin-terser"
import typescript from "rollup-plugin-typescript2"
const pkg = require("./package.json")
const banner = `/**
* @module ${pkg.name}
* @version ${pkg.version}
* @file ${pkg.description}
* @copyright ${pkg.author.name} ${new Date().getFullYear()}
* @license ${pkg.license}
* @see [Github]{@link ${pkg.homepage}}
*/`
const [, name] = pkg.name.split("/")
export default {
input: "src/index.ts",
output: [
{
file: `dist/${name}.js`,
name,
format: "iife",
banner
},
{
file: `dist/${name}.min.js`,
name,
format: "iife",
plugins: [terser({ output: { preamble: banner } })]
},
{ file: pkg.exports.require, format: "cjs", banner },
{ file: pkg.exports.import, format: "es", banner }
],
plugins: [typescript({ useTsconfigDeclarationDir: true })]
}