-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrollup.config.js
43 lines (40 loc) · 1.06 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
import {terser} from 'rollup-plugin-terser';
import typescript2 from 'rollup-plugin-typescript2';
import babel from '@rollup/plugin-babel';
import packageJson from './package.json';
const banner = `/* v${packageJson.version} https://wangwl.net/static/pages/utils.html */`
const isdev = process.env.NODE_ENV !== 'production';
const config = {
input: './src/index.ts',
output: [
{
file: 'dist/index.umd.js',
format: 'umd',
name: 'relaxUtils',
},
{
file: 'dist/index.es.js',
format: 'es',
},
{
file: 'dist/index.cjs.js',
format: 'cjs',
}
],
plugins: [
typescript2(),
babel({
babelHelpers: 'bundled'
}),
isdev ? undefined : terser({
compress: {drop_console: true},
format: {preamble: banner}
}),
].filter(p => p),
watch: isdev ? {
exclude: 'node_modules/**',
include: 'src/**',
buildDelay: 300
} : false
}
export default config;