This repository has been archived by the owner on Apr 8, 2020. It is now read-only.
forked from enketo/enketo-express
-
Notifications
You must be signed in to change notification settings - Fork 90
/
rollup.config.js
56 lines (50 loc) · 1.62 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
const resolve = require( 'rollup-plugin-node-resolve' );
const commonjs = require( 'rollup-plugin-commonjs' );
const builtins = require( 'rollup-plugin-node-builtins' );
const globals = require( 'rollup-plugin-node-globals' );
const alias = require( 'rollup-plugin-alias' );
const buildFiles = require( './buildFiles' );
const path = require( 'path' );
const pkg = require( './package' );
const aliases = Object.entries( pkg.browser ).reduce( ( arr, cur ) => {
arr.push( {
find: cur[ 0 ],
replacement: path.join( __dirname, cur[ 1 ] )
} );
return arr;
}, [] );
const plugins = [
alias( {
entries: aliases
} ),
resolve( {
browser: true, // Default: false
preferBuiltins: true // Explicit due to bug https://github.com/rollup/rollup-plugin-node-resolve/issues/196
} ),
commonjs( {
include: 'node_modules/**', // Default: undefined
sourceMap: false, // Default: true
} ),
builtins(),
globals(),
];
const onwarn = warning => {
// Silence circular dependency warning for jszip and rollup-plugin-node-builtins
if ( warning.code === 'CIRCULAR_DEPENDENCY' &&
( warning.importer.indexOf( 'node_modules/jszip/' ) !== -1 || warning.importer.indexOf( 'node_modules/rollup-plugin-node-builtins/' ) !== -1 ) ) {
return;
}
console.warn( `(!) ${warning.message}` );
};
const configs = buildFiles.entries.map( ( entryFile, i ) => {
return {
input: entryFile,
output: {
file: buildFiles.bundles[ i ],
format: 'iife',
},
plugins,
onwarn,
};
} );
module.exports = configs;