forked from NaridaL/brep.ts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
rollup.config.js
53 lines (51 loc) · 1.51 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 sourcemaps from 'rollup-plugin-sourcemaps'
import * as fs from 'fs'
import livereload from 'rollup-plugin-livereload'
import serve from 'rollup-plugin-serve'
const pkg = JSON.parse(fs.readFileSync('package.json'))
export default {
input: 'out/index.js',
output: [
{
format: 'cjs',
file: 'dist/bundle.js',
name: pkg.umdGlobal,
sourcemap: true,
globals: moduleName => require(moduleName + '/package.json').umdGlobal || pkg.umdGlobals && pkg.umdGlobals[moduleName],
},
{
format: 'es',
sourcemap: true,
file: 'dist/bundle.module.js'
},
],
external: Object.keys(pkg.dependencies),
// plugins: [
// sourcemaps(),
// process.env.ROLLUP_WATCH && serve(
// // {
// // contentBase: '.',
// // open: true,
// // host: 'localhost',
// // port: 10002
// // }
// ),
// process.env.ROLLUP_WATCH && livereload(),
// ].filter(x => x), // remove undefined
onwarn: function (warning, warn) {
// Suppress this error message... there are hundreds of them. Angular team says to ignore it.
// https://github.com/rollup/rollup/wiki/Troubleshooting#this-is-undefined
if ('THIS_IS_UNDEFINED' === warning.code) return
if ('CIRCULAR_DEPENDENCY' === warning.code) {
const m = warning.message.match(/^Circular dependency: (.*) -> .* -> .*$/)
if (m) {
const start = m[1]
if (start.match(/out[/\\]index.js|src[/\\]index.ts/)) {
// this is a loop of length three starting at the index file: don't warn
return
}
}
}
warn(warning)
},
}