-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
45 lines (42 loc) · 1.16 KB
/
rollup.config.js
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
37
38
39
40
41
42
43
44
45
import pkg from "./package.json";
import commonjs from "rollup-plugin-commonjs";
import resolve from "rollup-plugin-node-resolve";
import typescript from "rollup-plugin-typescript2";
import dts from "rollup-plugin-dts";
import { terser } from "rollup-plugin-terser";
const banner = `/*! Leaflet.SmoothGeodesic ${pkg.version} - created by Hunter Evanoff - https://github.com/hunter547/Leaflet.SmoothGeodesic */`;
const bundle = (format, filename, options = {}) => ({
input: "src/smoothgeodesic.ts",
output: {
file: filename,
format: format,
banner: banner,
name: "leaflet.smoothgeodesic",
sourcemap: false,
globals: {
leaflet: "L",
},
},
external: [...Object.keys(pkg.peerDependencies)],
plugins: [
...(options.resolve ? [resolve()] : []),
commonjs(),
typescript({
typescript: require("typescript"),
clean: true,
}),
...(options.minimize ? [terser()] : []),
],
});
export default [
// bundle("umd", pkg.browser, { resolve: true, minimize: true }),
bundle("esm", pkg.main, { resolve: false, minimize: true }),
{
input: "typings/leaflet.smoothgeodesic/index.d.ts",
output: {
file: pkg.types,
format: "es",
},
plugins: [dts()],
},
];