forked from hyperstart/hyperapp-devtools
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
executable file
·53 lines (49 loc) · 1.13 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
46
47
48
49
50
51
52
53
const minimist = require("minimist")
const commonjs = require("rollup-plugin-commonjs")
const nodeResolve = require("rollup-plugin-node-resolve")
const typescript = require("rollup-plugin-typescript2")
const uglify = require("rollup-plugin-uglify")
const postcss = require("rollup-plugin-postcss")
const serve = require("rollup-plugin-serve")
const options = minimist(process.argv.slice(2), {
boolean: ["min", "es", "serve"]
})
const plugins = [
nodeResolve({
extensions: [".ts", ".js", ".json"],
jsnext: true
}),
commonjs(),
typescript({
clean: true,
exclude: ["*.d.ts", "**/*.d.ts", "*.test.*", "**/*.test.*"]
}),
postcss({
plugins: []
})
]
if (options.min) {
plugins.push(uglify())
}
if (options.serve) {
plugins.push(
serve({
open: true,
contentBase: ["examples", "dist"]
})
)
}
export default {
input: "src/index.ts",
output: {
file: options.min
? "dist/hyperapp-devtools.min.js"
: options.es
? "dist/hyperapp-devtools.es.js"
: "dist/hyperapp-devtools.js",
format: options.es ? "es" : "umd",
name: "devtools",
sourcemap: true
},
plugins
}