-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
42 lines (40 loc) · 969 Bytes
/
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
import * as path from 'path';
import { terser } from "rollup-plugin-terser";
import typescript from 'rollup-plugin-typescript2';
import serve from 'rollup-plugin-serve';
const devMode = process.env.NODE_ENV === 'development';
const shouldServe = !!process.env.SERVE;
const filename = 'text-frame' + (devMode ? '' : '-min') + '.js';
const plugins = [
typescript({
clean: true,
tsconfig: './tsconfig.json'
}),
!devMode && terser(),
shouldServe && serve({
open: true,
contentBase: './',
openPage: '/example/index.html',
port: 5000
})
].filter(Boolean);
export default {
input: 'src/text-frame.ts',
output: [
{
file: path.resolve('dist', 'esm', filename),
format: 'esm',
sourcemap: devMode
},
{
file: path.resolve('dist', 'umd', filename),
format: 'umd',
name: 'TextFrame',
sourcemap: devMode
}
],
plugins: plugins,
watch: {
include: ['src/**/*', 'example/*']
}
}