-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
39 lines (36 loc) · 1.07 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
import commonjs from 'rollup-plugin-commonjs'
import sourceMaps from 'rollup-plugin-sourcemaps'
import camelCase from 'lodash.camelcase'
import typescript from 'rollup-plugin-typescript2'
import {terser} from "rollup-plugin-terser"
import tempDir from "temp-dir"
import autoExternal from 'rollup-plugin-auto-external';
const pkg = require('./package.json')
const libraryName = 'live-server'
const libVarName = camelCase(libraryName)
//const libClassName = `${libVarName[0].toUpperCase() + libVarName.slice(1)}` // PascalCase
// noinspection JSUnusedGlobalSymbols
export default {
input: `src/main.ts`,
output: {
file: pkg.main,
name: libVarName,
format: 'umd',
sourcemap: true,
exports: 'named',
banner: '#!/usr/bin/env node'
},
watch: {
include: 'src/**',
},
plugins: [
autoExternal(),
typescript({
useTsconfigDeclarationDir: true,
cacheRoot: `${tempDir}/.rpt2_cache`, // See: https://github.com/ezolenko/rollup-plugin-typescript2/issues/34#issuecomment-332591290
}),
commonjs(),
(process.env.BUILD === 'production' && terser()),
sourceMaps(),
],
}