forked from rollup/rollup
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
53 lines (47 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
44
45
46
47
48
49
50
51
52
53
import { readFileSync } from 'fs';
import buble from 'rollup-plugin-buble';
import nodeResolve from 'rollup-plugin-node-resolve';
import replace from 'rollup-plugin-replace';
var pkg = JSON.parse( readFileSync( 'package.json', 'utf-8' ) );
var commitHash = (function () {
try {
return readFileSync( '.commithash', 'utf-8' );
} catch ( err ) {
return 'unknown';
}
})();
var banner = readFileSync( 'src/banner.js', 'utf-8' )
.replace( '${version}', pkg.version )
.replace( '${time}', new Date() )
.replace( '${commitHash}', commitHash );
export default {
entry: 'src/rollup.js',
plugins: [
buble({
include: [ 'src/**', 'node_modules/acorn/**' ],
target: {
node: '0.12'
}
}),
nodeResolve({
jsnext: true
}),
replace({
include: 'src/rollup.js',
delimiters: [ '<@', '@>' ],
sourceMap: true,
values: { 'VERSION': pkg.version }
})
],
external: [
'fs',
'path'
],
banner: banner,
sourceMap: true,
moduleName: 'rollup',
targets: [
{ dest: 'dist/rollup.js', format: 'cjs' },
{ dest: 'dist/rollup.es.js', format: 'es' }
]
};