-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathrollup.config.js
More file actions
44 lines (41 loc) · 1011 Bytes
/
rollup.config.js
File metadata and controls
44 lines (41 loc) · 1011 Bytes
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
// Packages
import typescript from 'rollup-plugin-typescript2'
import uglify from 'rollup-plugin-uglify'
// Ours
import pkg from './package.json'
// Generates Rollup entries for test files
const testFiles = () => {
const entries = ['spec', 'helpers']
return entries.map(e => {
return {
input: `./test/${e}.ts`,
output: [{ file: `dist/test/${e}.js`, format: 'cjs' }],
external: ['ava'],
plugins: [typescript()]
}
})
}
export default [
// Browser build
{
input: 'src/index.ts',
output: [{ file: pkg.browser, format: 'umd', name: 'gfmc' }],
plugins: [
typescript({ tsconfigOverride: { compilerOptions: { target: 'es5' } } }),
uglify()
]
},
// Node.js/Bundlers
{
input: 'src/index.ts',
output: [
// CommonJS (for Node) build
{ file: pkg.main, format: 'cjs' },
// ES module (for bundlers) build
{ file: pkg.module, format: 'es' }
],
plugins: [typescript()]
},
// Test files
...testFiles()
]