-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrollup.config.mjs
More file actions
33 lines (31 loc) · 1.25 KB
/
rollup.config.mjs
File metadata and controls
33 lines (31 loc) · 1.25 KB
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
import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import typescript from '@rollup/plugin-typescript';
import terser from '@rollup/plugin-terser';
import { readFileSync } from 'node:fs';
const pkg = JSON.parse(readFileSync('./package.json', 'utf8'));
const dev = process.env.ROLLUP_WATCH === 'true';
export default {
input: 'src/adaptive-cover-pro-card.ts',
output: {
file: 'dist/adaptive-cover-pro-card.js',
format: 'es',
sourcemap: dev,
banner: `/*! adaptive-cover-pro-card v${pkg.version} | MIT License | https://github.com/jrhubott/adaptive-cover-pro-card */`,
},
// @formatjs/intl-utils (pulled in by custom-card-helpers) ships UMD with
// top-level `this`; rollup rewrites it to `undefined` and warns. Declare the
// module context as `window` so the TS `__extends`/`__assign` helpers resolve
// correctly and the warning goes away.
moduleContext: (id) => (id.includes('@formatjs/intl-utils') ? 'window' : undefined),
plugins: [
resolve({ browser: true }),
commonjs(),
typescript({ tsconfig: './tsconfig.json', sourceMap: dev, inlineSources: dev }),
!dev &&
terser({
format: { comments: /^!/ },
compress: { passes: 2 },
}),
].filter(Boolean),
};