-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
58 lines (48 loc) · 1.35 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import project from './package.json';
import buble from '@rollup/plugin-buble';
import { terser } from 'rollup-plugin-terser';
function buildConfig({ filename, format, transpile = true }) {
// Enforces the '.min.js' naming standard
const minify = filename.endsWith('.min.js');
const plugins = [];
if (transpile) plugins.push(buble());
if (minify) plugins.push(terser());
return {
input: './src/v8n.js',
output: {
name: project.name,
format,
file: './dist/' + filename,
sourcemap: minify,
exports: 'default',
},
plugins,
};
}
const configs = [
// AMD″
buildConfig({ filename: 'v8n.amd.js', format: 'amd' }),
// CJS
buildConfig({ filename: 'v8n.cjs.js', format: 'cjs' }),
// UMD
buildConfig({ filename: 'v8n.umd.js', format: 'umd' }),
buildConfig({ filename: 'v8n.min.js', format: 'umd' }),
// IIFE
buildConfig({ filename: 'v8n.browser.js', format: 'iife' }),
buildConfig({ filename: 'v8n.browser.min.js', format: 'iife' }),
// ESM
buildConfig({ filename: 'v8n.esm.js', format: 'es' }),
buildConfig({
filename: 'v8n.esm.browser.js',
format: 'es',
transpile: false,
}),
buildConfig({
filename: 'v8n.esm.browser.min.js',
format: 'es',
transpile: false,
}),
// System
buildConfig({ filename: 'v8n.system.js', format: 'system' }),
];
export default configs;