/
rollup.config.js
37 lines (35 loc) · 1.11 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
/* eslint-disable @typescript-eslint/explicit-function-return-type, @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/typedef, @typescript-eslint/no-unsafe-call, @typescript-eslint/no-unsafe-member-access */
import resolve from '@rollup/plugin-node-resolve';
import terser from '@rollup/plugin-terser';
// eslint-disable-next-line import/no-extraneous-dependencies
import { rollupPluginHTML as html } from '@web/rollup-plugin-html';
import minifyHTML from 'rollup-plugin-minify-html-literals';
import serve from 'rollup-plugin-serve';
const isServe = Boolean(process.env.SERVE);
export default {
input: 'hello-web-components.js',
output: {
dir: '.',
entryFileNames: '[name].min.js',
format: 'esm',
sourcemap: true,
},
external: isServe ? [] : [/lit/],
onwarn(warning, warn) {
if (warning.code === 'THIS_IS_UNDEFINED') {
return;
}
warn(warning);
},
plugins: isServe
? [resolve(), html(), serve()]
: [
minifyHTML.default(),
terser({
mangle: {
module: true,
properties: true,
},
}),
],
};