-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrollup.config.js
75 lines (72 loc) · 1.65 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import shim from 'rollup-plugin-shim';
import alias from 'rollup-plugin-alias';
import babel from 'rollup-plugin-babel';
import { uglify } from 'rollup-plugin-uglify';
import pkg from './package.json';
import nodeResolve from 'rollup-plugin-node-resolve';
const fake = { fs: 'export default {}', path: 'export default {}' };
const version = process.env.VERSION || pkg.version;
const sourcemap = true;
const banner = `/*
* jsg07@${version}, https://github.com/harttle/json-schema-generator
* (c) 2016-${new Date().getFullYear()} harttle
* Released under the MIT License.
*/`;
const treeshake = {
propertyReadSideEffects: false
};
const input = 'src/index.js';
const babelConf = {
babelrc: false,
presets: [['@babel/env', { modules: false }]],
plugins: ['@babel/plugin-external-helpers']
};
export default [{
output: [{
file: 'dist/jsg07.common.js',
name: 'jsg07',
format: 'cjs',
sourcemap,
banner
}],
external: ['path', 'fs'],
plugins: [
nodeResolve(),
babel(babelConf)
],
treeshake,
input
}, {
output: [{
file: 'dist/jsg07.js',
name: 'jsg07',
format: 'umd',
sourcemap,
banner
}],
plugins: [
shim(fake),
alias({
'./template': './template-browser'
}),
nodeResolve(),
babel(babelConf)
],
treeshake,
input
}, {
output: [{
file: 'dist/jsg07.min.js',
name: 'jsg07',
format: 'umd',
sourcemap
}],
plugins: [
shim(fake),
nodeResolve(),
babel(babelConf),
uglify()
],
treeshake,
input
}];