-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathrollup.config.js
57 lines (54 loc) · 1.45 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
54
55
56
57
import { literalsHtmlCssMinifier } from '@literals/rollup-plugin-html-css-minifier';
import html from '@rollup/plugin-html';
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
import typescript from '@rollup/plugin-typescript';
import serve from 'rollup-plugin-serve';
const onwarn = (warning, warn) => {
if (warning.code === 'THIS_IS_UNDEFINED') {
return;
}
warn(warning);
};
const isServe = process.env.npm_lifecycle_event === 'start';
export default isServe
? {
input: './demo/app.ts',
output: {
dir: 'docs',
format: 'esm',
inlineDynamicImports: true,
sourcemap: true,
},
plugins: [
typescript({
exclude: ['/lib', '/lit-redux-router.*', '**/*.test.*'],
tsconfig: 'tsconfig.build.json',
}),
resolve(),
html({
template: './demo/index.html',
}),
serve({ contentBase: 'docs', historyApiFallback: true }),
],
}
: {
external: ['lit', 'lit/decorators.js', 'lit/directives/unsafe-html.js', 'pwa-helpers'],
input: 'lit-redux-router.js',
onwarn,
output: {
file: 'lit-redux-router.min.js',
format: 'esm',
sourcemap: true,
},
plugins: [
literalsHtmlCssMinifier(),
resolve(),
terser({
mangle: {
module: true,
properties: true,
},
}),
],
};