-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrollup.config.js
More file actions
46 lines (41 loc) · 984 Bytes
/
rollup.config.js
File metadata and controls
46 lines (41 loc) · 984 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
45
46
// Native
import { readdirSync } from 'fs'
import { resolve, basename } from 'path'
// Packages
import typescript from 'rollup-plugin-typescript'
// Ours
import pkg from './package.json'
const plugins = [
typescript({
typescript: require('typescript')
})
]
// Generates Rollup entries for test files
const testFiles = () => {
const entries = readdirSync(resolve(__dirname, 'test'))
return entries.map(e => {
return {
input: `test/${e}`,
output: [{ file: `dist/${basename(e, '.ts')}-test.js`, format: 'cjs' }],
external: ['ava'],
plugins
}
})
}
export default [
// Main bundle
{
input: 'src/index.ts',
output: [
// CommonJS (for Node) build
{ file: pkg.main, format: 'cjs' },
// Browser-friendly UMD build
{ file: pkg.browser, format: 'umd', name: 'gfmc' },
// ES module (for bundlers) build
{ file: pkg.module, format: 'es' }
],
plugins
},
// Test files
...testFiles()
]