-
Notifications
You must be signed in to change notification settings - Fork 3
/
rollup.dev.config.js
41 lines (38 loc) · 1.09 KB
/
rollup.dev.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
import { nodeResolve } from "@rollup/plugin-node-resolve";
import commonjs from "rollup-plugin-commonjs";
import { terser } from "rollup-plugin-terser";
import html from "@rollup/plugin-html";
import serve from "rollup-plugin-serve";
import { readFileSync } from "fs";
export default {
input: "src/index.js",
output: {
file: "dist/mapbox-gl-draw-pinning-mode.js",
format: "umd",
name: "mapboxGlDrawPinningMode",
globals: {
"@mapbox/mapbox-gl-draw/src/modes/simple_select":
"MapboxDraw.modes.simple_select",
},
},
external: ["@mapbox/mapbox-gl-draw/src/modes/simple_select"],
plugins: [
nodeResolve(),
commonjs(),
html({
template: ({ attributes, bundle, files, publicPath, title }) => {
const fileName = files.js[0].fileName;
const template = readFileSync("docs/index.html", "utf-8");
return template.replace(
"https://unpkg.com/mapbox-gl-draw-pinning-mode",
`${publicPath}${fileName}`
);
},
}),
serve({
contentBase: "dist",
port: 8080,
open: true,
}),
],
};