1// Import rollup plugins
2import { rollupPluginHTML as html } from '@web/rollup-plugin-html';
3import { copy } from '@web/rollup-plugin-copy';
4import resolve from '@rollup/plugin-node-resolve';
5import { terser } from 'rollup-plugin-terser';
6import summary from 'rollup-plugin-summary';
7import { rollupImportMapPlugin } from "rollup-plugin-import-map";
8
9export default {
10  plugins: [
11    // Entry point for application build; can specify a glob to build multiple
12    // HTML files for non-SPA app
13    html({
14      input: ['./web/index.html', './web/dev.html']
15    }),
16    // Add Import maps from libraries to CDN urls
17    rollupImportMapPlugin([
18      {
19        "imports": {
20          'lit': 'https://cdn.jsdelivr.net/gh/lit/dist@2/core/lit-core.min.js',
21          'lit/decorators.js': 'https://cdn.skypack.dev/pin/lit@v2.5.0-jYRq0AKQogjUdUh7SCAE/mode=imports/optimized/lit/decorators.js',
22          'lit/directives/live.js': 'https://cdn.jsdelivr.net/gh/lit/dist@2/all/lit-all.min.js',
23          'lit/directives/style-map.js': 'https://cdn.jsdelivr.net/gh/lit/dist@2/all/lit-all.min.js',
24        }
25      }
26    ]),
27    // Resolve bare module specifiers to relative paths
28    resolve(),
29    // Minify JS
30    terser({
31      ecma: 2020,
32      module: true,
33      warnings: true,
34    }),
35    // Print bundle summary
36    summary(),
37    // Copy any static assets to build directory
38    copy({
39      patterns: ['./assets/*'],
40    }),
41  ],
42  output: {
43    dir: 'dist',
44    preserveModules: true,
45    preserveModulesRoot: 'web'
46  },
47  preserveEntrySignatures: 'strict',
48};